Code

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#600 closed enhancement (fixed)

decorator_from_middleware currently doesn't handle process_view

Reported by: hugo Owned by: adrian
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: UI/UX:

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 (0)

Change History (1)

comment:1 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.