Code cleanup in django.core.handlers.base.BaseHandler
|Reported by:||aaugustin||Owned by:||nobody|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||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.