Commit 1fe09357 authored by 's avatar

- fixed a traversal regression

parent 5d03ec13
...@@ -540,7 +540,7 @@ class BaseRequest: ...@@ -540,7 +540,7 @@ class BaseRequest:
if (no_acquire_flag and if (no_acquire_flag and
hasattr(parents[1], 'aq_base') and hasattr(parents[1], 'aq_base') and
not hasattr(parents[1],'__bobo_traverse__')): not hasattr(parents[1],'__bobo_traverse__')):
base = parents[-1].aq_base base = parents[1].aq_base
if not (hasattr(base, entry_name) or entry_name in base): if not (hasattr(base, entry_name) or entry_name in base):
raise AttributeError(entry_name) raise AttributeError(entry_name)
......
...@@ -73,6 +73,9 @@ class BaseRequest_factory: ...@@ -73,6 +73,9 @@ class BaseRequest_factory:
# Attribute without docstring. # Attribute without docstring.
return 'unpublishable' return 'unpublishable'
def __contains__(self, name):
return False
return DummyObjectBasic return DummyObjectBasic
def _makeBasicObject(self): def _makeBasicObject(self):
...@@ -194,6 +197,15 @@ class TestBaseRequest(unittest.TestCase, BaseRequest_factory): ...@@ -194,6 +197,15 @@ class TestBaseRequest(unittest.TestCase, BaseRequest_factory):
self.assertEqual(r.URL, '/folder/objBasic') self.assertEqual(r.URL, '/folder/objBasic')
self.assertEqual(r.response.base, '') self.assertEqual(r.response.base, '')
def test_traverse_basic_no_acquire_flag(self):
root, folder = self._makeRootAndFolder()
folder._setObject('objBasic', self._makeBasicObject())
r = self._makeOne(root)
r['REQUEST_METHOD'] = 'HEAD'
r.traverse('folder/objBasic')
self.assertEqual(r.URL, '/folder/objBasic')
self.assertEqual(r.response.base, '')
def test_traverse_withDefault(self): def test_traverse_withDefault(self):
root, folder = self._makeRootAndFolder() root, folder = self._makeRootAndFolder()
folder._setObject('objWithDefault', self._makeObjectWithDefault()) folder._setObject('objWithDefault', self._makeObjectWithDefault())
......
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