Skip to content

Commit

Permalink
Improve solidity of the debugError method (#830)
Browse files Browse the repository at this point in the history
Fixes #829
  • Loading branch information
ale-rt authored May 16, 2020
1 parent e7ebc33 commit e952da1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 e952da1

Please sign in to comment.