Log message for revision 114737: - LP #143564: Request.resolve_url did not correctly re-raise exceptions encountered during path traversal.
Changed: U Zope/trunk/doc/CHANGES.rst U Zope/trunk/src/ZPublisher/HTTPRequest.py U Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py -=- Modified: Zope/trunk/doc/CHANGES.rst =================================================================== --- Zope/trunk/doc/CHANGES.rst 2010-07-14 11:35:57 UTC (rev 114736) +++ Zope/trunk/doc/CHANGES.rst 2010-07-14 11:40:36 UTC (rev 114737) @@ -11,7 +11,10 @@ Bugs Fixed ++++++++++ +- LP #143564: Request.resolve_url did not correctly re-raise + exceptions encountered during path traversal. + Restructuring +++++++++++++ Modified: Zope/trunk/src/ZPublisher/HTTPRequest.py =================================================================== --- Zope/trunk/src/ZPublisher/HTTPRequest.py 2010-07-14 11:35:57 UTC (rev 114736) +++ Zope/trunk/src/ZPublisher/HTTPRequest.py 2010-07-14 11:40:36 UTC (rev 114737) @@ -1178,7 +1178,7 @@ rsp.exception() if object is None: req.clear() - raise rsp.errmsg, sys.exc_info()[1] + raise sys.exc_info()[0], rsp.errmsg # The traversal machinery may return a "default object" # like an index_html document. This is not appropriate Modified: Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py =================================================================== --- Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py 2010-07-14 11:35:57 UTC (rev 114736) +++ Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py 2010-07-14 11:40:36 UTC (rev 114737) @@ -19,6 +19,7 @@ def _makeOne(self, stdin=None, environ=None, response=None, clean=1): from StringIO import StringIO + from ZPublisher import NotFound if stdin is None: stdin = StringIO() @@ -37,7 +38,15 @@ if response is None: class _FauxResponse(object): _auth = None + debug_mode = False + errmsg = 'OK' + def notFoundError(self, message): + raise NotFound, message + + def exception(self, *args, **kw): + pass + response = _FauxResponse() return self._getTargetClass()(stdin, environ, response, clean) @@ -1002,6 +1011,16 @@ self.failIf(len(events), "HTTPRequest.resolve_url should not emit events") + def test_resolve_url_errorhandling(self): + # Check that resolve_url really raises the same error + # it received from ZPublisher.BaseRequest.traverse + from zExceptions import NotFound + request = self._makeOne() + request['PARENTS'] = [object()] + self.assertRaises( NotFound + , request.resolve_url + , request.script + '/does_not_exist' + ) def test_parses_json_cookies(self): # https://bugs.launchpad.net/zope2/+bug/563229 _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org https://mail.zope.org/mailman/listinfo/zope-checkins