[Zope-Checkins] SVN: Products.Five/trunk/browser/pagetemplatefile.py fixed traverser

Andreas Jung andreas at andreas-jung.com
Wed Mar 1 16:13:23 EST 2006


Log message for revision 65681:
  
  fixed traverser
  

Changed:
  U   Products.Five/trunk/browser/pagetemplatefile.py

-=-
Modified: Products.Five/trunk/browser/pagetemplatefile.py
===================================================================
--- Products.Five/trunk/browser/pagetemplatefile.py	2006-03-01 21:00:33 UTC (rev 65680)
+++ Products.Five/trunk/browser/pagetemplatefile.py	2006-03-01 21:13:20 UTC (rev 65681)
@@ -42,15 +42,15 @@
         next = getattr(object, name, _marker)
         if next is not _marker:
             object = next
-        elif hasattr(object, '__getitem__'):
+        else:
             try:
-                object = object[name]
-            except KeyError:
-                # deal with traversal through bobo_traverse()
                 object = object.restrictedTraverse(name)
-        else:
-            # Allow AttributeError to propagate
-            object = getattr(object, name)
+            except (KeyError, AttributeError):
+                try:
+                    object = object[name]
+                except:
+                    object = getattr(object, name)
+
     return object
 
 



More information about the Zope-Checkins mailing list