Ticket #12019: cache.py.patch
File cache.py.patch, 1.2 KB (added by , 15 years ago) |
---|
-
django/views/decorators/cache.py
16 16 except ImportError: 17 17 from django.utils.functional import wraps # Python 2.3, 2.4 fallback. 18 18 19 from django.conf import settings 19 20 from django.utils.decorators import decorator_from_middleware_with_args, available_attrs 20 21 from django.utils.cache import patch_cache_control, add_never_cache_headers 21 22 from django.middleware.cache import CacheMiddleware … … 47 48 else: 48 49 assert False, "cache_page must be passed either a single argument (timeout) or a view function and a timeout" 49 50 else: 50 return decorator_from_middleware_with_args(CacheMiddleware)(cache_timeout=args[0], key_prefix=key_prefix) 51 # Handle case of no args passed 52 try: 53 cache_timeout = args[0] 54 except IndexError: 55 cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS 56 return decorator_from_middleware_with_args(CacheMiddleware)(cache_timeout=cache_timeout, key_prefix=key_prefix) 51 57 52 58 53 59 def cache_control(**kwargs):