Skip to content

Commit

Permalink
Improve solidity of the debugError method
Browse files Browse the repository at this point in the history
Backport of #830 to the 4.x branch
  • Loading branch information
ale-rt committed May 16, 2020
1 parent 245d35b commit 849b87b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ https://zope.readthedocs.io/en/2.13/CHANGES.html
------------------

- Update dependencies to newest releases.
- Improve solidity of the ``debugError`` method.
(`#829 <https://github.com/zopefoundation/Zope/issues/829>`_)


4.4.2 (2020-04-30)
Expand Down
7 changes: 5 additions & 2 deletions src/ZPublisher/HTTPResponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,8 +826,11 @@ def notFoundError(self, entry='Unknown'):
def debugError(self, entry):
raise NotFound(self._error_html(
"Debugging Notice",
("Zope has encountered a problem publishing your object.<p>"
"\n" + entry + "</p>")))
(
"Zope has encountered a problem publishing your object. "
"<p>%r</p>" % entry
)
))

def badRequestError(self, name):
self.setStatus(400)
Expand Down
2 changes: 1 addition & 1 deletion src/ZPublisher/tests/testHTTPResponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ def test_debugError(self):
except NotFound as raised:
self.assertEqual(response.status, 200)
self.assertTrue("Zope has encountered a problem publishing "
"your object.<p>\ntesting</p>" in str(raised))
"your object. <p>'testing'</p>" in str(raised))
else:
self.fail("Didn't raise NotFound")

Expand Down

0 comments on commit 849b87b

Please sign in to comment.