[Zope-Checkins] SVN: Zope/trunk/ - Collector #2352: fix in
OFS.Traversable
Andreas Jung
andreas at andreas-jung.com
Sat Sep 15 12:45:50 EDT 2007
Log message for revision 79679:
- Collector #2352: fix in OFS.Traversable
Changed:
U Zope/trunk/doc/CHANGES.txt
U Zope/trunk/lib/python/OFS/Traversable.py
U Zope/trunk/lib/python/OFS/tests/testTraverse.py
-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt 2007-09-15 16:40:53 UTC (rev 79678)
+++ Zope/trunk/doc/CHANGES.txt 2007-09-15 16:45:50 UTC (rev 79679)
@@ -149,6 +149,8 @@
Bugs Fixed
+ - Collector #2352: fix in OFS.Traversable
+
- Collector #2346: username logging in FCGI crashed the server
- Collector #2339: ZPT: fixed unicode issue when using the 'structure'
Modified: Zope/trunk/lib/python/OFS/Traversable.py
===================================================================
--- Zope/trunk/lib/python/OFS/Traversable.py 2007-09-15 16:40:53 UTC (rev 79678)
+++ Zope/trunk/lib/python/OFS/Traversable.py 2007-09-15 16:45:50 UTC (rev 79679)
@@ -186,18 +186,18 @@
bobo_traverse = getattr(obj, '__bobo_traverse__', None)
try:
- if name and name[:1] in '@+' and name != '+':
+ if name and name[:1] in '@+' and name != '+' and nsParse(name)[1]:
# Process URI segment parameters.
ns, nm = nsParse(name)
- if ns:
- try:
- next = namespaceLookup(
- ns, nm, obj, self.REQUEST).__of__(obj)
- if restricted and not validate(
- obj, obj, name, next):
- raise Unauthorized(name)
- except TraversalError:
- raise AttributeError(name)
+ try:
+ next = namespaceLookup(
+ ns, nm, obj, self.REQUEST).__of__(obj)
+ if restricted and not validate(
+ obj, obj, name, next):
+ raise Unauthorized(name)
+ except TraversalError:
+ raise AttributeError(name)
+
elif bobo_traverse is not None:
next = bobo_traverse(REQUEST, name)
if restricted:
Modified: Zope/trunk/lib/python/OFS/tests/testTraverse.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testTraverse.py 2007-09-15 16:40:53 UTC (rev 79678)
+++ Zope/trunk/lib/python/OFS/tests/testTraverse.py 2007-09-15 16:45:50 UTC (rev 79679)
@@ -169,6 +169,7 @@
self.app = makerequest( self.root, stdout=responseOut )
manage_addFolder( self.app, 'folder1' )
folder1 = getattr( self.app, 'folder1' )
+ setattr(folder1, '+something', 'plus')
folder1.all_meta_types = \
( { 'name' : 'File'
@@ -378,8 +379,12 @@
self.failUnless(
aq_base(self.root.folder1.file.restrictedTraverse('../..')) is
aq_base(self.root))
+
+ def testTraverseToNameStartingWithPlus(self):
+ # Verify it's possible to traverse to a name such as +something
+ self.failUnless(
+ self.folder1.unrestrictedTraverse('+something') is 'plus')
-
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
More information about the Zope-Checkins
mailing list