Commit b592d3ef authored by Jens Vagelpohl's avatar Jens Vagelpohl

- LP #143564: Request.resolve_url did not correctly re-raise

  exceptions encountered during path traversal.
parent 366aee21
...@@ -11,6 +11,9 @@ http://docs.zope.org/zope2/releases/. ...@@ -11,6 +11,9 @@ http://docs.zope.org/zope2/releases/.
Bugs Fixed Bugs Fixed
++++++++++ ++++++++++
- LP #143564: Request.resolve_url did not correctly re-raise
exceptions encountered during path traversal.
- LP #143273: Enable the dtml-var modifiers url_quote, url_unquote, - LP #143273: Enable the dtml-var modifiers url_quote, url_unquote,
url_quote_plus and url_unquote_plus to handle unicode strings. url_quote_plus and url_unquote_plus to handle unicode strings.
......
...@@ -1178,7 +1178,7 @@ class HTTPRequest(BaseRequest): ...@@ -1178,7 +1178,7 @@ class HTTPRequest(BaseRequest):
rsp.exception() rsp.exception()
if object is None: if object is None:
req.clear() req.clear()
raise rsp.errmsg, sys.exc_info()[1] raise sys.exc_info()[0], rsp.errmsg
# The traversal machinery may return a "default object" # The traversal machinery may return a "default object"
# like an index_html document. This is not appropriate # like an index_html document. This is not appropriate
......
...@@ -19,6 +19,7 @@ class HTTPRequestTests(unittest.TestCase): ...@@ -19,6 +19,7 @@ class HTTPRequestTests(unittest.TestCase):
def _makeOne(self, stdin=None, environ=None, response=None, clean=1): def _makeOne(self, stdin=None, environ=None, response=None, clean=1):
from StringIO import StringIO from StringIO import StringIO
from ZPublisher import NotFound
if stdin is None: if stdin is None:
stdin = StringIO() stdin = StringIO()
...@@ -37,6 +38,14 @@ class HTTPRequestTests(unittest.TestCase): ...@@ -37,6 +38,14 @@ class HTTPRequestTests(unittest.TestCase):
if response is None: if response is None:
class _FauxResponse(object): class _FauxResponse(object):
_auth = None _auth = None
debug_mode = False
errmsg = 'OK'
def notFoundError(self, message):
raise NotFound, message
def exception(self, *args, **kw):
pass
response = _FauxResponse() response = _FauxResponse()
...@@ -995,6 +1004,16 @@ class HTTPRequestTests(unittest.TestCase): ...@@ -995,6 +1004,16 @@ class HTTPRequestTests(unittest.TestCase):
self.failIf(len(events), self.failIf(len(events),
"HTTPRequest.resolve_url should not emit 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): def test_parses_json_cookies(self):
# https://bugs.launchpad.net/zope2/+bug/563229 # https://bugs.launchpad.net/zope2/+bug/563229
......
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