Opened 4 weeks ago
Closed 3 weeks ago
#36994 closed Uncategorized (wontfix)
Middleware hooks working on functional middleware is not documented
| Reported by: | Aarni Koskela | Owned by: | Aarni Koskela |
|---|---|---|---|
| Component: | Core (Other) | Version: | 6.0 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Middleware hooks like process_exception, process_template_response, process_view factually work on function middleware (though process_template_response requires a gentle adjustment to how middleware name is computed).
This is undocumented behavior, so it would probably be best to codify it in documentation.
Change History (3)
comment:1 by , 4 weeks ago
| Has patch: | set |
|---|
comment:2 by , 4 weeks ago
I'm not aware of this being a duplicate ticket, but it does appear to be a duplicate of these existing PRs:
https://github.com/django/django/pull/19856
https://github.com/django/django/pull/19857
My tuppence worth is that it's kind of an implementation detail that the hooks happen to work with function-based middleware. Whilst I don't have much objection to documenting them (and so officially supporting them), I really can't imagine a scenario where I would ever want to write middleware by decorating a function with these hooks. Maybe there is a use-case though??
comment:3 by , 3 weeks ago
| Resolution: | → wontfix |
|---|---|
| Status: | assigned → closed |
I agree with Tim that there is no gain in documenting this nor a necessary commitment to ensure this works in the long term. Closing accordingly.
https://github.com/django/django/pull/20954