[Checkins] SVN: z3c.pt/trunk/z3c/pt/codegen.py Better handling of
attribute errors.
Malthe Borch
mborch at gmail.com
Tue Mar 4 11:59:30 EST 2008
Log message for revision 84458:
Better handling of attribute errors.
Changed:
U z3c.pt/trunk/z3c/pt/codegen.py
-=-
Modified: z3c.pt/trunk/z3c/pt/codegen.py
===================================================================
--- z3c.pt/trunk/z3c/pt/codegen.py 2008-03-04 16:55:38 UTC (rev 84457)
+++ z3c.pt/trunk/z3c/pt/codegen.py 2008-03-04 16:59:30 UTC (rev 84458)
@@ -24,16 +24,14 @@
@classmethod
def lookup_attr(cls, obj, key):
- __traceback_hide__ = True
- val = getattr(obj, key, UNDEFINED)
- if val is UNDEFINED:
+ try:
+ return getattr(obj, key)
+ except AttributeError, e:
try:
- val = obj[key]
+ return obj[key]
except (KeyError, TypeError):
- raise AttributeError(key)
+ raise e
- return val
-
class TemplateASTTransformer(ASTTransformer):
def __init__(self):
self.locals = [CONSTANTS]
More information about the Checkins
mailing list