Opened 7 years ago

Closed 7 years ago

#16399 closed Cleanup/optimization (fixed)

Code cleanup in django.core.handlers.base.BaseHandler

Reported by: Aymeric Augustin Owned by: nobody
Component: Core (Other) 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: yes UI/UX: no


In django.core.handlers.base.BaseHandler, __init__ sets all middleware lists to None; load_middleware creates and populates them.

There is a small inconsistency that probably dates back to the introduction of template response middleware: self._template_response_middleware isn't initialized, while the other lists are. I don't know if it creates a bug — at first sight, this initialization could be skipped entirely — but I believe it should be fixed for the shake of consistency.

Also, load_middleware's docstring refers to a __call__ method that doesn't exist in the class; I improved that comment.

Attached patch fixes this.

Attachments (1)

16399.diff (912 bytes) - added by Aymeric Augustin 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by Aymeric Augustin

Attachment: 16399.diff added

comment:1 Changed 7 years ago by Jannis Leidel

Triage Stage: UnreviewedReady for checkin

comment:2 Changed 7 years ago by Jannis Leidel

Resolution: fixed
Status: newclosed

In [16506]:

Fixed #16399 -- Minor cleanup in core handler. Thanks, aaugustin.

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