Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
@malcolmt malcolmt authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 django/utils/decorators.py
View
7 django/utils/decorators.py
@@ -8,6 +8,9 @@ def decorator_from_middleware(middleware_class):
lets you use middleware functionality on a per-view basis.
"""
def _decorator_from_middleware(*args, **kwargs):
+ # For historical reasons, these "decorators" are also called as
+ # dec(func, *args) instead of dec(*args)(func). We handle both forms
+ # for backwards compatibility.
has_func = True
try:
view_func = kwargs.pop('view_func')
@@ -17,9 +20,7 @@ def _decorator_from_middleware(*args, **kwargs):
else:
has_func = False
if not (has_func and isinstance(view_func, types.FunctionType)):
- # For historical reasons, these decorators are also called as
- # dec(func, *args) instead of dec(*args)(func). This branch handles
- # the backwards compatibility.
+ # We are being called as a decorator.
if has_func:
args = (view_func,) + args
middleware = middleware_class(*args, **kwargs)
Please sign in to comment.
Something went wrong with that request. Please try again.