[ZCM] [ZC] 2060/ 4 Resubmit "unrestrictedTraverse fails if path
contains // "
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Wed Apr 5 12:12:58 EDT 2006
Issue #2060 Update (Resubmit) "unrestrictedTraverse fails if path contains // "
Status Pending, Zope/bug+solution low
To followup, visit:
http://www.zope.org/Collectors/Zope/2060
==============================================================
= Resubmit - Entry #4 by efge on Apr 5, 2006 12:12 pm
Status: Rejected => Pending
IndexError is not fine. Nobody expects it to be returned from (un)restrictedTraverse so nobody will catch it.
________________________________________
= Reject - Entry #3 by chrisw on Apr 5, 2006 12:03 pm
Status: Pending => Rejected
I think an IndexError is just fine.
________________________________________
= Comment - Entry #2 by efge on Apr 5, 2006 10:34 am
Empty path elements have never been legal.
I'd rather raise a proper NotFound if one is found.
________________________________________
= 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