From 22e016ff6c18a35a450519b94de63033f83e6b4f Mon Sep 17 00:00:00 2001 From: Justin Bronn Date: Thu, 28 Feb 2008 21:24:51 +0000 Subject: gis: Merged revisions 7105-7168 via svnmerge from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@7176 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/views/decorators/cache.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'django/views/decorators/cache.py') 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) -- cgit v1.3