Skip to content

Commit

Permalink
- fixed a traversal regression
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Feb 23, 2012
1 parent 1dd4c83 commit e728c7b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ http://docs.zope.org/zope2/releases/.
2.13.14 (unreleased)
--------------------


- ZPublisher: Fixed a traversal regression introduced in 2.13.12.

2.13.13 (2012-02-20)
--------------------
Expand Down
2 changes: 1 addition & 1 deletion src/ZPublisher/BaseRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def traverse(self, path, response=None, validated_hook=None):
if (no_acquire_flag and
hasattr(parents[1], 'aq_base') and
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):
raise AttributeError(entry_name)

Expand Down
12 changes: 12 additions & 0 deletions src/ZPublisher/tests/testBaseRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ def noview(self):
# Attribute without docstring.
return 'unpublishable'

def __contains__(self, name):
return False

return DummyObjectBasic

def _makeBasicObject(self):
Expand Down Expand Up @@ -194,6 +197,15 @@ def test_traverse_basic(self):
self.assertEqual(r.URL, '/folder/objBasic')
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):
root, folder = self._makeRootAndFolder()
folder._setObject('objWithDefault', self._makeObjectWithDefault())
Expand Down

0 comments on commit e728c7b

Please sign in to comment.