Skip to content

Commit

Permalink
Improve solidity of the debugError method
Browse files Browse the repository at this point in the history
Fixes #829
  • Loading branch information
ale-rt committed May 16, 2020
1 parent e7ebc33 commit 363043f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Expand Up @@ -10,7 +10,8 @@ https://github.com/zopefoundation/Zope/blob/4.x/CHANGES.rst
5.0a3 (unreleased)
------------------

- Nothing changed yet.
- Improve solidity of the ``debugError`` method.
(`#829 <https://github.com/zopefoundation/Zope/issues/829>`_)


5.0a2 (2020-04-24)
Expand Down
7 changes: 5 additions & 2 deletions src/ZPublisher/HTTPResponse.py
Expand Up @@ -780,8 +780,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
Expand Up @@ -873,7 +873,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 363043f

Please sign in to comment.