PageRenderTime 56ms CodeModel.GetById 14ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause
  1. # -*- coding:utf-8 -*-
  2. from django.views.decorators.http import condition, etag, last_modified
  3. from django.http import HttpResponse
  4. from models import FULL_RESPONSE, LAST_MODIFIED, ETAG
  5. def index(request):
  6. return HttpResponse(FULL_RESPONSE)
  7. index = condition(lambda r: ETAG, lambda r: LAST_MODIFIED)(index)
  8. def last_modified_view1(request):
  9. return HttpResponse(FULL_RESPONSE)
  10. last_modified_view1 = condition(last_modified_func=lambda r: LAST_MODIFIED)(last_modified_view1)
  11. def last_modified_view2(request):
  12. return HttpResponse(FULL_RESPONSE)
  13. last_modified_view2 = last_modified(lambda r: LAST_MODIFIED)(last_modified_view2)
  14. def etag_view1(request):
  15. return HttpResponse(FULL_RESPONSE)
  16. etag_view1 = condition(etag_func=lambda r: ETAG)(etag_view1)
  17. def etag_view2(request):
  18. return HttpResponse(FULL_RESPONSE)
  19. etag_view2 = etag(lambda r: ETAG)(etag_view2)