Django

Code

Ticket #600 (closed: fixed)

Opened 3 years ago

Last modified 2 years ago

decorator_from_middleware currently doesn't handle process_view

Reported by: hugo Assigned to: adrian
Milestone: Component: Core framework
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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)

Attachments

Change History

10/10/05 08:51:58 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

(In [820]) Fixed #600 -- decorator_from_middleware now handles process_view. Thanks, Hugo


Add/Change #600 (decorator_from_middleware currently doesn't handle process_view)




Change Properties
Action