[ZCM] [ZC] 2060/ 1 Request "unrestrictedTraverse fails if path contains // "

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Wed Apr 5 10:28:26 EDT 2006


Issue #2060 Update (Request) "unrestrictedTraverse fails if path contains // "
 Status Pending, Zope/bug+solution low
To followup, visit:
  http://www.zope.org/Collectors/Zope/2060

==============================================================
= Request - Entry #1 by perrinjerome on Apr 5, 2006 10:28 am

If unrestrictedTraverse is called with a string path containing "//", it raise an IndexError. Currently, it splits the path using '/', iterates on the list of path elements, and checks if path[0] == '_' which raises a IndexError if the path element is an empty string.

One solution can be to skip the path element if it's an empty string at that point.

--- /usr/lib/zope/lib/python/OFS/Traversable.py 2003-12-10 18:53:31.000000000 +0100
+++ /home/jerome/Traversable.py 2006-04-05 15:54:47.931177500 +0200
@@ -143,6 +143,9 @@
                 name=pop()
                 __traceback_info__ = path, name

+                if name == '':
+                    continue
+
                 if name[0] == '_':
                     # Never allowed in a URL.
                     raise NotFound, name

==============================================================



More information about the Zope-Collector-Monitor mailing list