PageRenderTime 403ms CodeModel.GetById 221ms app.highlight 3ms RepoModel.GetById 178ms app.codeStats 0ms

/tests/regressiontests/conditional_processing/views.py

https://code.google.com/p/mango-py/
Python | 26 lines | 18 code | 7 blank | 1 comment | 0 complexity | b87ae68e48512c4cfcce90fcefca4f14 MD5 | raw file
 1# -*- coding:utf-8 -*-
 2from django.views.decorators.http import condition, etag, last_modified
 3from django.http import HttpResponse
 4
 5from models import FULL_RESPONSE, LAST_MODIFIED, ETAG
 6
 7def index(request):
 8    return HttpResponse(FULL_RESPONSE)
 9index = condition(lambda r: ETAG, lambda r: LAST_MODIFIED)(index)
10
11def last_modified_view1(request):
12    return HttpResponse(FULL_RESPONSE)
13last_modified_view1 = condition(last_modified_func=lambda r: LAST_MODIFIED)(last_modified_view1)
14
15def last_modified_view2(request):
16    return HttpResponse(FULL_RESPONSE)
17last_modified_view2 = last_modified(lambda r: LAST_MODIFIED)(last_modified_view2)
18
19def etag_view1(request):
20    return HttpResponse(FULL_RESPONSE)
21etag_view1 = condition(etag_func=lambda r: ETAG)(etag_view1)
22
23def etag_view2(request):
24    return HttpResponse(FULL_RESPONSE)
25etag_view2 = etag(lambda r: ETAG)(etag_view2)
26