Opened 10 years ago
Closed 10 years ago
#26546 closed Cleanup/optimization (fixed)
Allow HTTPStatus enum values to be used as HttpResponse.status
| Reported by: | David Evans | Owned by: | nobody |
|---|---|---|---|
| Component: | HTTP handling | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Python 3.5 provides an HTTPStatus enum for representing HTTP statuses. The values of this enum are subclasses of int, so it ought to be possible to use them as the status argument to the HttpResponse constructor.
However the WSGIHandler classes uses %s formatting rather than %d, which causes the values to be rendered as, e.g. "HTTPStatus.OK" rather than "200".
The associated patch (a single character change, excluding the tests) fixes this.
Change History (3)
comment:1 by , 10 years ago
| Has patch: | set |
|---|
comment:2 by , 10 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:3 by , 10 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
In 2fcafd1: