Log message for revision 85833:
  Forward port fix for LP#213311 from 2.10 branch.

Changed:
  U   Zope/branches/2.11/doc/CHANGES.txt
  U   Zope/branches/2.11/lib/python/ZPublisher/BaseRequest.py
  U   Zope/branches/2.11/lib/python/ZPublisher/tests/testBaseRequest.py

-=-
Modified: Zope/branches/2.11/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.11/doc/CHANGES.txt  2008-04-28 21:02:02 UTC (rev 85832)
+++ Zope/branches/2.11/doc/CHANGES.txt  2008-04-28 21:06:37 UTC (rev 85833)
@@ -8,6 +8,9 @@
 
     Bugs Fixed
 
+      - Launchpad #213311:  Handle "unsubscriptable object" errors
+        during publishing traversal.
+
       - Products.Five: Fixed vocabulary lookup broken in 2.11 beta 1.
         ZopeVocabularyRegistry wasn't hooked up on startup.
 

Modified: Zope/branches/2.11/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/branches/2.11/lib/python/ZPublisher/BaseRequest.py     2008-04-28 
21:02:02 UTC (rev 85832)
+++ Zope/branches/2.11/lib/python/ZPublisher/BaseRequest.py     2008-04-28 
21:06:37 UTC (rev 85833)
@@ -121,7 +121,10 @@
                     pass
 
                 # Lastly we try with key access:
-                subobject = object[name]
+                try:
+                    subobject = object[name]
+                except TypeError: # unsubscriptable
+                    raise KeyError(name)
                 
 
         # Ensure that the object has a docstring, or that the parent

Modified: Zope/branches/2.11/lib/python/ZPublisher/tests/testBaseRequest.py
===================================================================
--- Zope/branches/2.11/lib/python/ZPublisher/tests/testBaseRequest.py   
2008-04-28 21:02:02 UTC (rev 85832)
+++ Zope/branches/2.11/lib/python/ZPublisher/tests/testBaseRequest.py   
2008-04-28 21:06:37 UTC (rev 85833)
@@ -244,7 +244,16 @@
         r._hold(lambda x: None)
         self.assertEqual(r._held, None)
 
+    def test_traverse_unsubscriptable(self):
+        # See https://bugs.launchpad.net/bugs/213311
+        from ZPublisher import NotFound
+        class _Object(object):
+            pass
+        root = _Object()
+        r = self._makeOne(None)
+        self.assertRaises(NotFound, r.traverse, 'not_found')
 
+
 class TestBaseRequestZope3Views(unittest.TestCase):
 
     def _getTargetClass(self):

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to