Opened 3 years ago
Closed 3 years ago
#33575 closed Bug (wontfix)
process_template_response() can not be a static method, but documentation suggests otherwise.
Reported by: | Eugene Vihrev | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 4.0 |
Severity: | Normal | Keywords: | middleware, documentation |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In documentation page on other middleware hooks (https://docs.djangoproject.com/en/4.0/topics/http/middleware/#process-template-response) signature of process_template_response
method does not have self
among its arguments, suggesting it is not required, so the method can be marked as static. Doing so results in non-verbose error occurring in | django/core/handlers/base.py on line 256 due to how django gets middleware name from middleware_method
(middleware_method.__self__.__class__.__name__
).
I think that documentation should have self
in the method signature and user should get a verbose message that @staticmethod
is not allowed. Or maybe this behaviour should be changed so all middleware hook methods could be static.
Change History (1)
comment:1 by , 3 years ago
Component: | Core (Other) → Documentation |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Summary: | 'process_template_response' middleware hook can not be a static method, but documentation suggests otherwise → process_template_response() can not be a static method, but documentation suggests otherwise. |
Thanks for this ticket, however we don't include
self
in methods signatures, see comment and 757aefc12b79bac1bab730ac465fbfd3f810b61d.