From 4c011e6f36039344a917133979c247ed9ad67b00 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sat, 7 Jul 2007 18:39:23 +0000 Subject: [PATCH] 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 --- django/utils/decorators.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/django/utils/decorators.py b/django/utils/decorators.py index 54014a82b58..57ce29fca4e 100644 --- a/django/utils/decorators.py +++ b/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(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)