Ticket #15840: 15840.patch.diff
File 15840.patch.diff, 1.8 KB (added by , 14 years ago) |
---|
-
django/views/decorators/http.py
150 150 151 151 return response 152 152 153 return inner153 return wraps(func, assigned=available_attrs(func))(inner) 154 154 return decorator 155 155 156 156 # Shortcut decorators for common cases based on ETag or Last-Modified only -
tests/regressiontests/decorators/tests.py
6 6 from django.utils.decorators import method_decorator 7 7 from django.utils.functional import allow_lazy, lazy, memoize 8 8 from django.utils.unittest import TestCase 9 from django.views.decorators.http import require_http_methods, require_GET, require_POST 9 from django.views.decorators.http import require_http_methods, require_GET, require_POST, condition, etag, last_modified 10 10 from django.views.decorators.vary import vary_on_headers, vary_on_cookie 11 11 from django.views.decorators.cache import cache_page, never_cache, cache_control 12 12 … … 21 21 fully_decorated = require_GET(fully_decorated) 22 22 fully_decorated = require_POST(fully_decorated) 23 23 24 def last_modified_method(request): 25 return None 26 27 def etag_method(request): 28 return None 29 30 fully_decorated = condition(etag_func=etag_method, last_modified_func=last_modified_method)(fully_decorated) 31 fully_decorated = etag(etag_method)(fully_decorated) 32 fully_decorated = last_modified(last_modified_method)(fully_decorated) 33 24 34 # django.views.decorators.vary 25 35 fully_decorated = vary_on_headers('Accept-language')(fully_decorated) 26 36 fully_decorated = vary_on_cookie(fully_decorated)