diff --git a/django/utils/functional.py b/django/utils/functional.py index 37cc7c7f0f..628e02e8d8 100644 --- a/django/utils/functional.py +++ b/django/utils/functional.py @@ -205,6 +205,8 @@ def allow_lazy(func, *resultclasses): immediately, otherwise a __proxy__ is returned that will evaluate the function when needed. """ + lazy_func = lazy(func, *resultclasses) + @wraps(func) def wrapper(*args, **kwargs): for arg in list(args) + list(six.itervalues(kwargs)): @@ -212,7 +214,7 @@ def allow_lazy(func, *resultclasses): break else: return func(*args, **kwargs) - return lazy(func, *resultclasses)(*args, **kwargs) + return lazy_func(*args, **kwargs) return wrapper empty = object()