Commit 8bf9bc2d authored by Andreas Jung's avatar Andreas Jung

- Collector #2352: fix in OFS.Traversable

parent a046edbe
...@@ -8,6 +8,8 @@ Zope Changes ...@@ -8,6 +8,8 @@ Zope Changes
Bugs fixed Bugs fixed
- Collector #2352: fix in OFS.Traversable
- Collector #2346: username logging in FCGI crashed the server - Collector #2346: username logging in FCGI crashed the server
- ZopePageTemplate's pt_edit did not recognize content type arguments - ZopePageTemplate's pt_edit did not recognize content type arguments
......
...@@ -186,18 +186,18 @@ class Traversable: ...@@ -186,18 +186,18 @@ class Traversable:
bobo_traverse = getattr(obj, '__bobo_traverse__', None) bobo_traverse = getattr(obj, '__bobo_traverse__', None)
try: 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. # Process URI segment parameters.
ns, nm = nsParse(name) ns, nm = nsParse(name)
if ns: try:
try: next = namespaceLookup(
next = namespaceLookup( ns, nm, obj, self.REQUEST).__of__(obj)
ns, nm, obj, self.REQUEST).__of__(obj) if restricted and not validate(
if restricted and not validate( obj, obj, name, next):
obj, obj, name, next): raise Unauthorized(name)
raise Unauthorized(name) except TraversalError:
except TraversalError: raise AttributeError(name)
raise AttributeError(name)
elif bobo_traverse is not None: elif bobo_traverse is not None:
next = bobo_traverse(REQUEST, name) next = bobo_traverse(REQUEST, name)
if restricted: if restricted:
......
...@@ -169,6 +169,7 @@ class TestTraverse( unittest.TestCase ): ...@@ -169,6 +169,7 @@ class TestTraverse( unittest.TestCase ):
self.app = makerequest( self.root, stdout=responseOut ) self.app = makerequest( self.root, stdout=responseOut )
manage_addFolder( self.app, 'folder1' ) manage_addFolder( self.app, 'folder1' )
folder1 = getattr( self.app, 'folder1' ) folder1 = getattr( self.app, 'folder1' )
setattr(folder1, '+something', 'plus')
folder1.all_meta_types = \ folder1.all_meta_types = \
( { 'name' : 'File' ( { 'name' : 'File'
...@@ -378,7 +379,11 @@ class TestTraverse( unittest.TestCase ): ...@@ -378,7 +379,11 @@ class TestTraverse( unittest.TestCase ):
self.failUnless( self.failUnless(
aq_base(self.root.folder1.file.restrictedTraverse('../..')) is aq_base(self.root.folder1.file.restrictedTraverse('../..')) is
aq_base(self.root)) 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 import os, sys
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment