#33575: 'process_template_response' middleware hook can not be a static method,
but
documentation suggests otherwise
-------------------------------------+-------------------------------------
Reporter: Eugene | Owner: nobody
Vihrev |
Type: Bug | Status: new
Component: Core | Version: 4.0
(Other) | Keywords: middleware,
Severity: Normal | documentation
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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
[https://github.com/django/django/blob/4.0.2/django/core/handlers/base.py#L256
| 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.
--
Ticket URL: <https://code.djangoproject.com/ticket/33575>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107017f8834ada5-32f6b534-ace3-4ec4-9a2a-695639b33fbc-000000%40eu-central-1.amazonses.com.