[Django] #36994: Middleware hooks working on functional middleware is not documented

4 views
Skip to first unread message

Django

unread,
Mar 20, 2026, 7:36:04 AM (23 hours ago) Mar 20
to django-...@googlegroups.com
#36994: Middleware hooks working on functional middleware is not documented
-----------------------------------------+-------------------------------
Reporter: Aarni Koskela | Owner: Aarni Koskela
Type: Uncategorized | Status: assigned
Component: Core (Other) | Version: 6.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+-------------------------------
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/36994>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 20, 2026, 8:05:00 AM (23 hours ago) Mar 20
to django-...@googlegroups.com
#36994: Middleware hooks working on functional middleware is not documented
-------------------------------+-----------------------------------------
Reporter: Aarni Koskela | Owner: Aarni Koskela
Type: Uncategorized | Status: assigned
Component: Core (Other) | Version: 6.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+-----------------------------------------
Changes (by Aarni Koskela):

* has_patch: 0 => 1

Comment:

https://github.com/django/django/pull/20954
--
Ticket URL: <https://code.djangoproject.com/ticket/36994#comment:1>

Django

unread,
Mar 20, 2026, 7:37:41 PM (11 hours ago) Mar 20
to django-...@googlegroups.com
#36994: Middleware hooks working on functional middleware is not documented
-------------------------------+-----------------------------------------
Reporter: Aarni Koskela | Owner: Aarni Koskela
Type: Uncategorized | Status: assigned
Component: Core (Other) | Version: 6.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+-----------------------------------------
Comment (by Tim McCurrach):

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??
--
Ticket URL: <https://code.djangoproject.com/ticket/36994#comment:2>
Reply all
Reply to author
Forward
0 new messages