mirror of
https://github.com/django/django.git
synced 2024-12-23 09:36:06 +00:00
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
This commit is contained in:
parent
8c85ddf306
commit
4c011e6f36
@ -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(middleware_class):
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user