Opened 8 years ago

Closed 8 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


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 David Evans, 8 years ago

Has patch: set

comment:2 by Tim Graham, 8 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In 2fcafd1:

Fixed #26546 -- Allowed HTTPStatus enum values for HttpResponse.status.

Note: See TracTickets for help on using tickets.
Back to Top