#600 closed enhancement (fixed)
decorator_from_middleware currently doesn't handle process_view
Reported by: | hugo | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | Core (Other) | Version: | |
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
When writing decorator_from_middleware, I only looked at the cache middleware and those only use process_request and process_response. This patch should add process_view support:
Index: django/utils/decorators.py =================================================================== --- django/utils/decorators.py (revision 817) +++ django/utils/decorators.py (working copy) @@ -12,6 +12,10 @@ result = middleware.process_request(request) if result is not None: return result + if hasattr(middleware, 'process_view'): + result = middleware.process_view(request, view_func, **kwargs) + if result is not None: + return result response = view_func(request, *args, **kwargs) if hasattr(middleware, 'process_response'): result = middleware.process_response(request, response)
Note:
See TracTickets
for help on using tickets.
(In [820]) Fixed #600 -- decorator_from_middleware now handles process_view. Thanks, Hugo