Commit 3a4f9544 authored by Tres Seaver's avatar Tres Seaver

Forward port fix for LP#213311 from 2.10 branch.

parent d8a7e73f
......@@ -123,7 +123,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
......
......@@ -245,6 +245,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