#26548 closed Bug (duplicate)
HttpResponse.__str__ is missing on Python 3
Reported by: | Robert Rollins | Owned by: | nobody |
---|---|---|---|
Component: | HTTP handling | Version: | 1.9 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The HttpResponse class includes this block:
if six.PY3: __bytes__ = serialize else: __str__ = serialize
Because str is not defined when six.PY3
is True, calling str(response_object)
falls back to repr on Python 3. However, str is defined on Python 2, and it returns the full HTTP message.
It seems like bad idea to have the output of the "convert to string" action be different based on Python version, as it makes multi-version code difficult to implement and debug.
Change History (1)
comment:1 by , 9 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Version 0, edited 9 years ago by (next)
Note:
See TracTickets
for help on using tickets.
Whoops, due to an error, I accidentally posted this bug twice. I'll close this copy.