Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Corrected misleading comment from [5619]. Not sure what I was smoking…

… at the

time.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5631 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4c011e6f36039344a917133979c247ed9ad67b00 1 parent 8c85ddf
Malcolm Tredinnick authored July 07, 2007

Showing 1 changed file with 4 additions and 3 deletions. Show diff stats Hide diff stats

  1. 7  django/utils/decorators.py
7  django/utils/decorators.py
@@ -8,6 +8,9 @@ def decorator_from_middleware(middleware_class):
8 8
     lets you use middleware functionality on a per-view basis.
9 9
     """
10 10
     def _decorator_from_middleware(*args, **kwargs):
  11
+        # For historical reasons, these "decorators" are also called as
  12
+        # dec(func, *args) instead of dec(*args)(func). We handle both forms
  13
+        # for backwards compatibility.
11 14
         has_func = True
12 15
         try:
13 16
             view_func = kwargs.pop('view_func')
@@ -17,9 +20,7 @@ def _decorator_from_middleware(*args, **kwargs):
17 20
             else:
18 21
                 has_func = False
19 22
         if not (has_func and isinstance(view_func, types.FunctionType)):
20  
-            # For historical reasons, these decorators are also called as
21  
-            # dec(func, *args) instead of dec(*args)(func). This branch handles
22  
-            # the backwards compatibility.
  23
+            # We are being called as a decorator.
23 24
             if has_func:
24 25
                 args = (view_func,) + args
25 26
             middleware = middleware_class(*args, **kwargs)

0 notes on commit 4c011e6

Please sign in to comment.
Something went wrong with that request. Please try again.