[Zope-Checkins] SVN: Zope/branches/2.13/src/OFS/Traversable.py Really revert all experimental changes to OFS.Traversable

Hanno Schlichting hannosch at hannosch.eu
Sat Aug 20 12:26:13 EDT 2011


Log message for revision 122635:
  Really revert all experimental changes to OFS.Traversable
  

Changed:
  U   Zope/branches/2.13/src/OFS/Traversable.py

-=-
Modified: Zope/branches/2.13/src/OFS/Traversable.py
===================================================================
--- Zope/branches/2.13/src/OFS/Traversable.py	2011-08-20 16:21:56 UTC (rev 122634)
+++ Zope/branches/2.13/src/OFS/Traversable.py	2011-08-20 16:26:13 UTC (rev 122635)
@@ -146,25 +146,26 @@
         if not path:
             return self
 
-        if type(path) is str:
+        if isinstance(path, str):
             # Unicode paths are not allowed
             path = path.split('/')
         else:
             path = list(path)
 
         REQUEST = {'TraversalRequestNameStack': path}
+        path.reverse()
         path_pop = path.pop
 
-        if not path[-1]:
+        if len(path) > 1 and not path[0]:
             # Remove trailing slash
-            path_pop()
+            path_pop(0)
 
         if restricted:
             validate = getSecurityManager().validate
 
-        if path and not path[0]:
+        if not path[-1]:
             # If the path starts with an empty string, go to the root first.
-            path_pop(0)
+            path_pop()
             obj = self.getPhysicalRoot()
             if restricted:
                 validate(None, None, None, obj) # may raise Unauthorized
@@ -173,7 +174,8 @@
 
         resource = _marker
         try:
-            for name in path:
+            while path:
+                name = path_pop()
                 __traceback_info__ = path, name
 
                 if name[0] == '_':



More information about the Zope-Checkins mailing list