[Zope-Checkins] SVN: Zope/branches/2.10/ Don't publish acquired attributes if acquired object has no docstring.

Tres Seaver tseaver at palladion.com
Sun Feb 6 08:26:27 EST 2011


Log message for revision 120124:
  Don't publish acquired attributes if acquired object has no docstring.
  
  See https://bugs.launchpad.net/zope2/+bug/713253/
  

Changed:
  U   Zope/branches/2.10/doc/CHANGES.txt
  U   Zope/branches/2.10/inst/WinBuilders/mk/zope.mk
  U   Zope/branches/2.10/inst/versions.py
  U   Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py
  U   Zope/branches/2.10/lib/python/ZPublisher/tests/testBaseRequest.py
  U   Zope/branches/2.10/setup.py

-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.10/doc/CHANGES.txt	2011-02-05 19:45:07 UTC (rev 120123)
+++ Zope/branches/2.10/doc/CHANGES.txt	2011-02-06 13:26:26 UTC (rev 120124)
@@ -4,6 +4,14 @@
   Change information for previous versions of Zope can be found in the
   file HISTORY.txt.
 
+  Zope 2.10.13 (2011/02/04)
+
+    Bugs fixed
+
+      - Prevent publication of acquired attributes, where the acquired
+        object does not have a docstring.
+        https://bugs.launchpad.net/zope2/+bug/713253/
+
   Zope 2.10.12 (2010/09/01)
 
     Bugs fixed

Modified: Zope/branches/2.10/inst/WinBuilders/mk/zope.mk
===================================================================
--- Zope/branches/2.10/inst/WinBuilders/mk/zope.mk	2011-02-05 19:45:07 UTC (rev 120123)
+++ Zope/branches/2.10/inst/WinBuilders/mk/zope.mk	2011-02-06 13:26:26 UTC (rev 120124)
@@ -1,4 +1,4 @@
-ZOPEVERSION = 2.10.12-final
+ZOPEVERSION = 2.10.13-final
 ZOPEDIRNAME := Zope-$(ZOPEVERSION)
 
 ZOPE_REQUIRED_FILES=tmp/$(ZOPEDIRNAME).tgz

Modified: Zope/branches/2.10/inst/versions.py
===================================================================
--- Zope/branches/2.10/inst/versions.py	2011-02-05 19:45:07 UTC (rev 120123)
+++ Zope/branches/2.10/inst/versions.py	2011-02-06 13:26:26 UTC (rev 120124)
@@ -1,5 +1,5 @@
 ZOPE_MAJOR_VERSION  = '2.10'
-ZOPE_MINOR_VERSION  = '12'
+ZOPE_MINOR_VERSION  = '13'
 ZOPE_BRANCH_NAME    = '$Name$'[6:] or 'no-branch'
 
 # always start prerelease branches with '0' to avoid upgrade

Modified: Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py	2011-02-05 19:45:07 UTC (rev 120123)
+++ Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py	2011-02-06 13:26:26 UTC (rev 120124)
@@ -116,23 +116,21 @@
                     # Again, clear any error status created by __bobo_traverse__
                     # because we actually found something:
                     request.response.setStatus(200)
-                    return subobject
                 except AttributeError:
                     pass
 
                 # Lastly we try with key access:
-                try:
-                    subobject = object[name]
-                except TypeError: # unsubscriptable
-                    raise KeyError(name)
+                if subobject is None:
+                    try:
+                        subobject = object[name]
+                    except TypeError: # unsubscriptable
+                        raise KeyError(name)
                 
 
         # Ensure that the object has a docstring, or that the parent
         # object has a pseudo-docstring for the object. Objects that
         # have an empty or missing docstring are not published.
         doc = getattr(subobject, '__doc__', None)
-        if doc is None:
-            doc = getattr(object, '%s__doc__' % name, None)
         if not doc:
             raise Forbidden(
                 "The object at %s has an empty or missing " \

Modified: Zope/branches/2.10/lib/python/ZPublisher/tests/testBaseRequest.py
===================================================================
--- Zope/branches/2.10/lib/python/ZPublisher/tests/testBaseRequest.py	2011-02-05 19:45:07 UTC (rev 120123)
+++ Zope/branches/2.10/lib/python/ZPublisher/tests/testBaseRequest.py	2011-02-06 13:26:26 UTC (rev 120124)
@@ -166,6 +166,13 @@
         r = self._makeOne(root)
         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', DummyObjectWithoutDocstring())
+        r = self._makeOne(root)
+        self.assertRaises(NotFound, r.traverse, 'folder/objBasic')
+
     def test_traverse_class_without_docstring(self):
         from ZPublisher import NotFound
         root, folder = self._makeRootAndFolder()

Modified: Zope/branches/2.10/setup.py
===================================================================
--- Zope/branches/2.10/setup.py	2011-02-05 19:45:07 UTC (rev 120123)
+++ Zope/branches/2.10/setup.py	2011-02-06 13:26:26 UTC (rev 120124)
@@ -462,7 +462,7 @@
 
 setup(name='Zope',
       author=AUTHOR,
-      version="2.10.7-dev",
+      version="2.10.13",
       maintainer="Zope Corporation",
       maintainer_email="zope-dev at zope.org",
       url = "http://www.zope.org/",



More information about the Zope-Checkins mailing list