2009-03-22 08:58:29 +01:00
|
|
|
from django.http import HttpResponse
|
2015-01-28 13:35:27 +01:00
|
|
|
from django.views.decorators.http import condition, etag, last_modified
|
2009-03-22 08:58:29 +01:00
|
|
|
|
2015-01-28 13:35:27 +01:00
|
|
|
from .tests import ETAG, FULL_RESPONSE, LAST_MODIFIED
|
2011-10-13 20:51:33 +02:00
|
|
|
|
2009-03-22 08:58:29 +01:00
|
|
|
|
|
|
|
def index(request):
|
|
|
|
return HttpResponse(FULL_RESPONSE)
|
2009-03-24 04:01:46 +01:00
|
|
|
index = condition(lambda r: ETAG, lambda r: LAST_MODIFIED)(index)
|
2009-03-22 08:58:29 +01:00
|
|
|
|
2013-11-03 05:36:09 +01:00
|
|
|
|
2009-03-24 04:01:46 +01:00
|
|
|
def last_modified_view1(request):
|
2009-03-22 08:58:29 +01:00
|
|
|
return HttpResponse(FULL_RESPONSE)
|
2009-03-24 04:01:46 +01:00
|
|
|
last_modified_view1 = condition(last_modified_func=lambda r: LAST_MODIFIED)(last_modified_view1)
|
2009-03-22 08:58:29 +01:00
|
|
|
|
2013-11-03 05:36:09 +01:00
|
|
|
|
2009-03-24 04:01:46 +01:00
|
|
|
def last_modified_view2(request):
|
2009-03-22 08:58:29 +01:00
|
|
|
return HttpResponse(FULL_RESPONSE)
|
2009-03-24 04:01:46 +01:00
|
|
|
last_modified_view2 = last_modified(lambda r: LAST_MODIFIED)(last_modified_view2)
|
|
|
|
|
2013-11-03 05:36:09 +01:00
|
|
|
|
2009-03-24 04:01:46 +01:00
|
|
|
def etag_view1(request):
|
|
|
|
return HttpResponse(FULL_RESPONSE)
|
|
|
|
etag_view1 = condition(etag_func=lambda r: ETAG)(etag_view1)
|
|
|
|
|
2013-11-03 05:36:09 +01:00
|
|
|
|
2009-03-24 04:01:46 +01:00
|
|
|
def etag_view2(request):
|
|
|
|
return HttpResponse(FULL_RESPONSE)
|
|
|
|
etag_view2 = etag(lambda r: ETAG)(etag_view2)
|