Opened 5 years ago

Closed 5 years ago

#16178 closed Cleanup/optimization (fixed)

Cleanup request classes' __repr__()

Reported by: Julien Phalip Owned by: nobody
Component: HTTP handling Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

As discussed in https://code.djangoproject.com/ticket/14614#comment:16, there are a few small inconsistencies and some duplicated code in HttpRequest's, ModPythonRequest's, and WSGIRequest's __repr__() methods, and since [16339] also in ExceptionReporterFilter.get_request_repr (). The attached patch consolidates all that code into a single function. Note that I had to initialise the _post_parse_error attribute in the HttpRequest constructor, which should make sense since that attribute is used in some of HttpRequest's methods anyway.

Attachments (1)

16178.request_repr.diff (11.4 KB) - added by Julien Phalip 5 years ago.

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by Julien Phalip

Attachment: 16178.request_repr.diff added

comment:1 Changed 5 years ago by Ernesto Rico-Schmidt

Triage Stage: UnreviewedAccepted

Patch looks good, it applies without problem. The tests pass.

comment:2 Changed 5 years ago by Ramiro Morales

Triage Stage: AcceptedReady for checkin

Any patch that removes ~40 lines of code from the core and adds the same amount of them to the test is RFC in my book :)

comment:3 Changed 5 years ago by Luke Plant

See also #12098

comment:4 Changed 5 years ago by Luke Plant

Resolution: fixed
Status: newclosed

In [16350]:

Fixed #16178 - Cleanup request classes' __repr__()

Thanks to julien for the patch.

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