Commit 7a5a1dcd authored by Tres Seaver's avatar Tres Seaver

Launchpad #213311: Handle "unsubscriptable object" errors during publishing

traversal.
parent 1bd87200
......@@ -8,6 +8,9 @@ Zope Changes
Bugs fixed
- Launchpad #213311: Handle "unsubscriptable object" errors
during publishing traversal.
- Launchpad #143813: zopectl now exits non-zero when
child processes fail.
......
......@@ -121,7 +121,10 @@ class DefaultPublishTraverse(object):
pass
# Lastly we try with key access:
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