changeset 42:28ddb79414b2 trunk

Catch `KeyError` exception when trying attribute access in expression evaluation.
author cmlenz
date Mon, 03 Jul 2006 21:50:56 +0000
parents 686059a8a32b
children e03b77726756
files markup/eval.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/markup/eval.py
+++ b/markup/eval.py
@@ -125,7 +125,7 @@
                 return getattr(obj, node.attrname)
             try:
                 return obj[node.attrname]
-            except TypeError:
+            except (KeyError, TypeError):
                 return None
 
         def _visit_slice(self, node, data):
@@ -265,7 +265,7 @@
                 return getattr(obj, node.attr)
             try:
                 return obj[node.attr]
-            except TypeError:
+            except (KeyError, TypeError):
                 return None
 
         def _visit_call(self, node, data):
Copyright (C) 2012-2017 Edgewall Software