Mercurial > genshi > genshi-test
changeset 42:61a3a8b84888
Catch `KeyError` exception when trying attribute access in expression evaluation.
author | cmlenz |
---|---|
date | Mon, 03 Jul 2006 21:50:56 +0000 |
parents | a2e014fb9a3d |
children | e93de542929b |
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):