Used decorators in conditional_processing test views.

This commit is contained in:
Tim Graham 2016-09-10 08:23:53 -04:00
parent 4ef0e019b7
commit 14879ac61d
1 changed files with 5 additions and 5 deletions

View File

@ -4,29 +4,29 @@ from django.views.decorators.http import condition, etag, last_modified
from .tests import ETAG, FULL_RESPONSE, LAST_MODIFIED from .tests import ETAG, FULL_RESPONSE, LAST_MODIFIED
@condition(lambda r: ETAG, lambda r: LAST_MODIFIED)
def index(request): def index(request):
return HttpResponse(FULL_RESPONSE) return HttpResponse(FULL_RESPONSE)
index = condition(lambda r: ETAG, lambda r: LAST_MODIFIED)(index)
@condition(last_modified_func=lambda r: LAST_MODIFIED)
def last_modified_view1(request): def last_modified_view1(request):
return HttpResponse(FULL_RESPONSE) return HttpResponse(FULL_RESPONSE)
last_modified_view1 = condition(last_modified_func=lambda r: LAST_MODIFIED)(last_modified_view1)
@last_modified(lambda r: LAST_MODIFIED)
def last_modified_view2(request): def last_modified_view2(request):
return HttpResponse(FULL_RESPONSE) return HttpResponse(FULL_RESPONSE)
last_modified_view2 = last_modified(lambda r: LAST_MODIFIED)(last_modified_view2)
@condition(etag_func=lambda r: ETAG)
def etag_view1(request): def etag_view1(request):
return HttpResponse(FULL_RESPONSE) return HttpResponse(FULL_RESPONSE)
etag_view1 = condition(etag_func=lambda r: ETAG)(etag_view1)
@etag(lambda r: ETAG)
def etag_view2(request): def etag_view2(request):
return HttpResponse(FULL_RESPONSE) return HttpResponse(FULL_RESPONSE)
etag_view2 = etag(lambda r: ETAG)(etag_view2)
@condition(etag_func=lambda r: ETAG.strip('"')) @condition(etag_func=lambda r: ETAG.strip('"'))