diff --git a/django/views/decorators/http.py b/django/views/decorators/http.py
index 6fc882e..482d5ee 100644
a
|
b
|
def condition(etag_func=None, last_modified_func=None):
|
154 | 154 | |
155 | 155 | return response |
156 | 156 | |
157 | | return inner |
| 157 | return wraps(func, assigned=available_attrs(func))(inner) |
158 | 158 | return decorator |
159 | 159 | |
160 | 160 | # Shortcut decorators for common cases based on ETag or Last-Modified only |
diff --git a/tests/regressiontests/decorators/tests.py b/tests/regressiontests/decorators/tests.py
index 52a1ecd..cfac6de 100644
a
|
b
|
from django.http import HttpResponse, HttpRequest, HttpResponseNotAllowed
|
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, require_safe |
| 9 | from django.views.decorators.http import require_http_methods, require_GET, require_POST, require_safe, 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 | |
… |
… |
fully_decorated.anything = "Expected __dict__"
|
20 | 20 | fully_decorated = require_http_methods(["GET"])(fully_decorated) |
21 | 21 | fully_decorated = require_GET(fully_decorated) |
22 | 22 | fully_decorated = require_POST(fully_decorated) |
| 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 | |
23 | 34 | fully_decorated = require_safe(fully_decorated) |
24 | 35 | |
| 36 | def last_modified_method(request): |
| 37 | return None |
| 38 | |
| 39 | def etag_method(request): |
| 40 | return None |
| 41 | |
| 42 | fully_decorated = condition(etag_func=etag_method, last_modified_func=last_modified_method)(fully_decorated) |
| 43 | fully_decorated = etag(etag_method)(fully_decorated) |
| 44 | fully_decorated = last_modified(last_modified_method)(fully_decorated) |
| 45 | |
25 | 46 | # django.views.decorators.vary |
26 | 47 | fully_decorated = vary_on_headers('Accept-language')(fully_decorated) |
27 | 48 | fully_decorated = vary_on_cookie(fully_decorated) |