diff options
Diffstat (limited to 'django/views/decorators/cache.py')
| -rw-r--r-- | django/views/decorators/cache.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/django/views/decorators/cache.py b/django/views/decorators/cache.py index b04cc2340b..8b620c1345 100644 --- a/django/views/decorators/cache.py +++ b/django/views/decorators/cache.py @@ -11,6 +11,11 @@ Additionally, all headers from the response's Vary header will be taken into account on caching -- just like the middleware does. """ +try: + from functools import wraps +except ImportError: + from django.utils.functional import wraps # Python 2.3, 2.4 fallback. + from django.utils.decorators import decorator_from_middleware from django.utils.cache import patch_cache_control, add_never_cache_headers from django.middleware.cache import CacheMiddleware @@ -26,7 +31,7 @@ def cache_control(**kwargs): patch_cache_control(response, **kwargs) return response - return _cache_controlled + return wraps(viewfunc)(_cache_controlled) return _cache_controller @@ -39,4 +44,4 @@ def never_cache(view_func): response = view_func(request, *args, **kwargs) add_never_cache_headers(response) return response - return _wrapped_view_func + return wraps(view_func)(_wrapped_view_func) |
