Ticket #15840: 15840.patch.diff

File 15840.patch.diff, 1.8 KB (added by portante, 14 years ago)
  • django/views/decorators/http.py

     
    150150
    151151            return response
    152152
    153         return inner
     153        return wraps(func, assigned=available_attrs(func))(inner)
    154154    return decorator
    155155
    156156# Shortcut decorators for common cases based on ETag or Last-Modified only
  • tests/regressiontests/decorators/tests.py

     
    66from django.utils.decorators import method_decorator
    77from django.utils.functional import allow_lazy, lazy, memoize
    88from django.utils.unittest import TestCase
    9 from django.views.decorators.http import require_http_methods, require_GET, require_POST
     9from django.views.decorators.http import require_http_methods, require_GET, require_POST, condition, etag, last_modified
    1010from django.views.decorators.vary import vary_on_headers, vary_on_cookie
    1111from django.views.decorators.cache import cache_page, never_cache, cache_control
    1212
     
    2121fully_decorated = require_GET(fully_decorated)
    2222fully_decorated = require_POST(fully_decorated)
    2323
     24def last_modified_method(request):
     25    return None
     26
     27def etag_method(request):
     28    return None
     29
     30fully_decorated = condition(etag_func=etag_method, last_modified_func=last_modified_method)(fully_decorated)
     31fully_decorated = etag(etag_method)(fully_decorated)
     32fully_decorated = last_modified(last_modified_method)(fully_decorated)
     33
    2434# django.views.decorators.vary
    2535fully_decorated = vary_on_headers('Accept-language')(fully_decorated)
    2636fully_decorated = vary_on_cookie(fully_decorated)
Back to Top