Opened 9 years ago
Closed 9 years ago
#27831 closed New feature (duplicate)
decorator_from_middleware is not compatible with new middlewares
| Reported by: | Andreas Pelme | Owned by: | nobody |
|---|---|---|---|
| Component: | Utilities | Version: | 1.10 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The old middlewares is deprecated, but decorator_from_middleware assumes old style middleware and does not work with the new style.
decorator_from_middleware is very useful, not having it for new middlewares is a bummer.
Currently, one needs to use django.utils.deprecation.MiddlewareMixin to use it with newly written middlewares.
I'm not sure if it is possible to support both styles with decorator_from_middleware since the API:s (passing get_response) is different.
Maybe the best way forward would be to introduce a new util function that deals with the new style middleware?
Duplicate of #26626. Could you add your use case to that ticket?