[Checkins] SVN: five.pt/trunk/ Use bobo traversal if 'OFS.interfaces.ITraversable' interface is provided.

Malthe Borch mborch at gmail.com
Tue Dec 16 06:59:06 EST 2008


Log message for revision 94117:
  Use bobo traversal if 'OFS.interfaces.ITraversable' interface is provided.

Changed:
  U   five.pt/trunk/CHANGES.txt
  U   five.pt/trunk/src/five/pt/expressions.py

-=-
Modified: five.pt/trunk/CHANGES.txt
===================================================================
--- five.pt/trunk/CHANGES.txt	2008-12-16 11:39:23 UTC (rev 94116)
+++ five.pt/trunk/CHANGES.txt	2008-12-16 11:59:06 UTC (rev 94117)
@@ -1,9 +1,11 @@
 Changelog
 =========
 
-HEAD
-----
+In next release
 
+- Use bobo traversal if ``OFS.interfaces.ITraversable`` interface is
+  provided. [malthe]
+
 - Adjusted the path expression to provide the full namespace to the render
   function and not just the request. This matches Zope2 behavior. [hannosch]
 

Modified: five.pt/trunk/src/five/pt/expressions.py
===================================================================
--- five.pt/trunk/src/five/pt/expressions.py	2008-12-16 11:39:23 UTC (rev 94116)
+++ five.pt/trunk/src/five/pt/expressions.py	2008-12-16 11:59:06 UTC (rev 94117)
@@ -4,6 +4,7 @@
 from z3c.pt.expressions import ProviderTranslator
 
 from zExceptions import NotFound, Unauthorized
+from OFS.interfaces import ITraversable
 
 from zope import component
 from zope.traversing.adapters import traversePathElement
@@ -39,6 +40,8 @@
                     # special-case dicts for performance reasons
                     if isinstance(base, dict):
                         base = base[name]
+                    elif ITraversable.providedBy(base):
+                        base = base.restrictedTraverse(name)
                     else:
                         base = traversePathElement(
                             base, name, path_items[i:], request=scope['request'])



More information about the Checkins mailing list