Opened 4 years ago

Closed 4 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: master
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 Changed 4 years ago by David Evans

Has patch: set

comment:2 Changed 4 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:3 Changed 4 years ago by Tim Graham <timograham@…>

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