[Zope-Checkins] SVN: Zope/trunk/lib/python/ZPublisher/ Forward port
fix for LP#213311 from 2.10 branch.
Tres Seaver
tseaver at palladion.com
Mon Apr 28 17:19:28 EDT 2008
Log message for revision 85836:
Forward port fix for LP#213311 from 2.10 branch.
Changed:
U Zope/trunk/lib/python/ZPublisher/BaseRequest.py
U Zope/trunk/lib/python/ZPublisher/tests/testBaseRequest.py
-=-
Modified: Zope/trunk/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/BaseRequest.py 2008-04-28 21:15:18 UTC (rev 85835)
+++ Zope/trunk/lib/python/ZPublisher/BaseRequest.py 2008-04-28 21:19:27 UTC (rev 85836)
@@ -123,7 +123,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/trunk/lib/python/ZPublisher/tests/testBaseRequest.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/tests/testBaseRequest.py 2008-04-28 21:15:18 UTC (rev 85835)
+++ Zope/trunk/lib/python/ZPublisher/tests/testBaseRequest.py 2008-04-28 21:19:27 UTC (rev 85836)
@@ -245,7 +245,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):
More information about the Zope-Checkins
mailing list