Commit d2027e9f authored by Tres Seaver's avatar Tres Seaver

Forward port fix for LP#213311 from 2.10 branch.

parent 77732c38
......@@ -8,6 +8,9 @@ Zope Changes
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.
......
......@@ -121,7 +121,10 @@ class DefaultPublishTraverse(object):
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
......
......@@ -244,6 +244,15 @@ class TestBaseRequest(unittest.TestCase):
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):
......
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