[Checkins] SVN: z3c.pt/trunk/ Reverted c88488, malthe pointed out a problem with properties...

Hanno Schlichting plone at hannosch.info
Fri Jul 18 06:55:48 EDT 2008


Log message for revision 88489:
  Reverted c88488, malthe pointed out a problem with properties...
  

Changed:
  U   z3c.pt/trunk/CHANGES.txt
  U   z3c.pt/trunk/src/z3c/pt/codegen.py

-=-
Modified: z3c.pt/trunk/CHANGES.txt
===================================================================
--- z3c.pt/trunk/CHANGES.txt	2008-07-18 10:45:15 UTC (rev 88488)
+++ z3c.pt/trunk/CHANGES.txt	2008-07-18 10:55:47 UTC (rev 88489)
@@ -4,9 +4,6 @@
 Version 0.8.x
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-- Avoid a try/except in Lookup.lookup_attr and use a getattr with an
-  `is marker` comparison instead.
-
 - Simplified the _escape function handling by pulling in the str call into the
   function. Corrected the bigtable hotshot test to only benchmark rendering.
 

Modified: z3c.pt/trunk/src/z3c/pt/codegen.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/codegen.py	2008-07-18 10:45:15 UTC (rev 88488)
+++ z3c.pt/trunk/src/z3c/pt/codegen.py	2008-07-18 10:55:47 UTC (rev 88489)
@@ -24,13 +24,13 @@
 
     @classmethod
     def lookup_attr(cls, obj, key):
-        value = getattr(obj, key, marker)
-        if value is marker:
+        try:
+            return getattr(obj, key)
+        except AttributeError, e:
             try:
                 return obj[key]
             except (KeyError, TypeError):
                 raise e
-        return value
 
 class TemplateASTTransformer(ASTTransformer):
     def __init__(self):



More information about the Checkins mailing list