Commit f3eb73b5 authored by Tres Seaver's avatar Tres Seaver

Don't publish acquired attributes if acquired object has no docstring.

See https://bugs.launchpad.net/zope2/+bug/713253/
parent 96508959
...@@ -5,7 +5,7 @@ This file contains change information for the current Zope release. ...@@ -5,7 +5,7 @@ This file contains change information for the current Zope release.
Change information for previous versions of Zope can be found at Change information for previous versions of Zope can be found at
http://docs.zope.org/zope2/releases/. http://docs.zope.org/zope2/releases/.
2.13.3 (unreleased) 2.13.3 (2011-02-04)
------------------- -------------------
Features Added Features Added
...@@ -17,6 +17,9 @@ Features Added ...@@ -17,6 +17,9 @@ Features Added
Bugs Fixed Bugs Fixed
++++++++++ ++++++++++
- LP #713253: Prevent publication of acquired attributes, where the acquired
object does not have a docstring.
2.13.2 (2011-01-19) 2.13.2 (2011-01-19)
......
...@@ -23,7 +23,7 @@ if sys.platform[:3].lower() == "win": ...@@ -23,7 +23,7 @@ if sys.platform[:3].lower() == "win":
setup(name='Zope2', setup(name='Zope2',
version='2.13.3dev', version='2.13.3',
url='http://zope2.zope.org', url='http://zope2.zope.org',
license='ZPL 2.1', license='ZPL 2.1',
description='Zope2 application server / web framework', description='Zope2 application server / web framework',
......
...@@ -126,15 +126,15 @@ class DefaultPublishTraverse(object): ...@@ -126,15 +126,15 @@ class DefaultPublishTraverse(object):
# Again, clear any error status created by __bobo_traverse__ # Again, clear any error status created by __bobo_traverse__
# because we actually found something: # because we actually found something:
request.response.setStatus(200) request.response.setStatus(200)
return subobject
except AttributeError: except AttributeError:
pass pass
# Lastly we try with key access: # Lastly we try with key access:
try: if subobject is None:
subobject = object[name] try:
except TypeError: # unsubscriptable subobject = object[name]
raise KeyError(name) except TypeError: # unsubscriptable
raise KeyError(name)
# Ensure that the object has a docstring, or that the parent # Ensure that the object has a docstring, or that the parent
# object has a pseudo-docstring for the object. Objects that # object has a pseudo-docstring for the object. Objects that
......
...@@ -335,6 +335,14 @@ class TestBaseRequest(unittest.TestCase, BaseRequest_factory): ...@@ -335,6 +335,14 @@ class TestBaseRequest(unittest.TestCase, BaseRequest_factory):
r = self._makeOne(root) r = self._makeOne(root)
self.assertRaises(NotFound, r.traverse, 'folder/objBasic/noview') self.assertRaises(NotFound, r.traverse, 'folder/objBasic/noview')
def test_traverse_acquired_attribute_without_docstring(self):
from ZPublisher import NotFound
root, folder = self._makeRootAndFolder()
root._setObject('objBasic',
self._makeObjectWithEmptyDocstring())
r = self._makeOne(root)
self.assertRaises(NotFound, r.traverse, 'folder/objBasic')
def test_traverse_class_without_docstring(self): def test_traverse_class_without_docstring(self):
from ZPublisher import NotFound from ZPublisher import NotFound
root, folder = self._makeRootAndFolder() root, folder = self._makeRootAndFolder()
......
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