Skip to content

Commit

Permalink
Adjust docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Dick committed Jan 17, 2022
1 parent 7a9ee12 commit 0191b1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Expand Up @@ -13,7 +13,8 @@ https://github.com/zopefoundation/Zope/blob/4.x/CHANGES.rst

- Update to newest compatible versions of dependencies.

- Use string representation of response data that has no ``__bytes__``
- Use intermediate ``str`` representation for complex response data (i.e. not
``str`` or ``bytes`` like)
(`#1006 <https://github.com/zopefoundation/Zope/issues/1006>`_)


Expand Down
10 changes: 6 additions & 4 deletions src/ZPublisher/HTTPResponse.py
Expand Up @@ -498,11 +498,13 @@ def setBody(self, body, title='', is_error=False, lock=None):
If the body is a 2-element tuple, then it will be treated
as (title,body)
If body is unicode, encode it.
If body has an 'asHTML' method, replace it by the result of that
method.
If body is not a string or unicode, but has an 'asHTML' method, use
the result of that method as the body; otherwise, use the 'str'
of body.
If body is unicode, encode it. If it is more complex (no str or bytes
and no '__bytes__' method), use its 'str' representation and encode the
result. Else, convert it to bytes, falling back to the encoded 'str'
representation if this yields an error.
If is_error is true, format the HTML as a Zope error message instead
of a generic HTML page.
Expand Down

0 comments on commit 0191b1b

Please sign in to comment.