Skip to content

Commit

Permalink
Merge branch 'master' into issue_562
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed May 2, 2019
2 parents 6ca8d61 + b6fa2ab commit 8876587
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.rst
Expand Up @@ -37,6 +37,10 @@ Fixes

- prevent ``mkwsgiinstance`` from blowing up parsing ``buildout.cfg``

- Fix ``ZPublisher.HTTPResponse.HTTPBaseResponse.isHTML`` for binary data on
Python 3.
(`#577 <https://github.com/zopefoundation/Zope/pull/577>`_)

Features
++++++++

Expand Down
2 changes: 1 addition & 1 deletion src/ZPublisher/HTTPResponse.py
Expand Up @@ -461,7 +461,7 @@ def isHTML(self, text):
try:
text = text.decode(self.charset)
except UnicodeDecodeError:
pass
return False
text = text.lstrip()
# Note that the string can be big, so text.lower().startswith()
# is more expensive than s[:n].lower().
Expand Down
4 changes: 4 additions & 0 deletions src/ZPublisher/tests/testHTTPResponse.py
Expand Up @@ -1354,3 +1354,7 @@ def test_exception_500_text(self):
self.assertTrue(expected in bytes(body))
self.assertEqual(response.status, 500)
self.assertEqual(response.errmsg, 'Internal Server Error')

def test_isHTML_not_decodable_bytes(self):
response = self._makeOne()
self.assertFalse(response.isHTML(u'bïñårÿ'.encode('latin1')))

0 comments on commit 8876587

Please sign in to comment.