Comment 3 for bug 213311

Revision history for this message
Tres Seaver (tseaver) wrote : Re: [Bug 213311] Re: Zope 2.11b1: "BaseRequest.traverse" may fail without "__getitem__"

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

dmaurer wrote:
> This is the test case, I added to
> "ZPublisher.tests.testBaseRequest.TestBaseRequest":
>
> def test_traverse_no_subscription(self):
> class _Object(object): pass
> self.root = _Object()
> r = self.makeBaseRequest()
> from ZPublisher import NotFound
> self.assertRaises(NotFound, r.traverse, 'not_found')
>
> And this is the resulting traceback:
>
> Error in test test_traverse_no_subscription (ZPublisher.tests.testBaseRequest.TestBaseRequest)
> Traceback (most recent call last):
> File "/usr/local/lib/python2.4/unittest.py", line 260, in run
> testMethod()
> File "/home/dieter/G/z211/Base/lib/python/ZPublisher/tests/testBaseRequest.py", line 123, in test_traverse_no_subscription
> self.assertRaises(NotFound, r.traverse, 'not_found')
> File "/usr/local/lib/python2.4/unittest.py", line 320, in failUnlessRaises
> callableObj(*args, **kwargs)
> File "/home/dieter/G/Zope-2.11.0-b1/lib/python/ZPublisher/BaseRequest.py", line 485, in traverse
> File "/home/dieter/G/Zope-2.11.0-b1/lib/python/ZPublisher/BaseRequest.py", line 329, in traverseName
> File "/home/dieter/G/Zope-2.11.0-b1/lib/python/ZPublisher/BaseRequest.py", line 124, in publishTraverse
> TypeError: unsubscriptable object

The attached patch adds that test and a fix: all tests pass after
applying it to the 2.10 branch.

Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 <email address hidden>
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH+nA9+gerLs4ltQ4RAs0mAJ9sHVBmPqAmdisgI1RhT0mArMlrZQCeLB3H
ubuLWo/HpPilQc3O5zoehKg=
=Aw79
-----END PGP SIGNATURE-----