Opened 4 years ago

Closed 4 years ago

#16399 closed Cleanup/optimization (fixed)

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

Reported by: aaugustin 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 aaugustin 4 years ago.

Download all attachments as: .zip

Change History (3)

Changed 4 years ago by aaugustin

comment:1 Changed 4 years ago by jezdez

  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

In [16506]:

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

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