[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/Products/PageTemplates/Expressions.py Applying restrictedTraverse fix to the PageTemplate version for 2.8.

Alec Mitchell apm13 at columbia.edu
Tue May 9 16:04:19 EDT 2006


Log message for revision 68071:
  Applying restrictedTraverse fix to the PageTemplate version for 2.8.
  

Changed:
  U   Zope/branches/Zope-2_8-branch/lib/python/Products/PageTemplates/Expressions.py

-=-
Modified: Zope/branches/Zope-2_8-branch/lib/python/Products/PageTemplates/Expressions.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Products/PageTemplates/Expressions.py	2006-05-09 20:03:11 UTC (rev 68070)
+++ Zope/branches/Zope-2_8-branch/lib/python/Products/PageTemplates/Expressions.py	2006-05-09 20:04:19 UTC (rev 68071)
@@ -294,7 +294,19 @@
                 container = o.im_self
             elif (has(aq_base(object), name) and get(object, name) == o):
                 container = object
-            if not validate(object, container, name, o):
+            try:
+                validated = validate(object, container, name, o)
+            except Unauthorized:
+                # If next is a simple unwrapped property, it's
+                # parentage is indeterminate, but it may have been
+                # acquired safely.  In this case validate will
+                # raise an error, and we can explicitly check that
+                # our value was acquired safely.
+                validated = 0
+                if container is None and \
+                                        guarded_getattr(object, name, M) is o:
+                    validated = 1
+            if not validated:
                 raise Unauthorized, name
         else:
             # Try an attribute.



More information about the Zope-Checkins mailing list