Skip to content

Commit

Permalink
Revert "Avoid casting the body to a string when it is already a string (
Browse files Browse the repository at this point in the history
#1208)"

This reverts commit fdb1268.
  • Loading branch information
ale-rt committed Apr 30, 2024
1 parent fdb1268 commit 7089da1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ https://github.com/zopefoundation/Zope/blob/4.x/CHANGES.rst
For details, see
`#1202 <https://github.com/zopefoundation/Zope/issues/1202>`_.

- Small optimization when encoding the response body.

5.9 (2023-11-24)
----------------
Expand Down
4 changes: 1 addition & 3 deletions src/ZPublisher/HTTPResponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,7 @@ def setBody(self, body, title='', is_error=False, lock=None):
except (TypeError, UnicodeError):
pass
if not isinstance(body, bytes):
if not isinstance(body, str):
body = str(body)
body = self._encode_unicode(body)
body = self._encode_unicode(str(body))

# At this point body is always binary
b_len = len(body)
Expand Down

0 comments on commit 7089da1

Please sign in to comment.