Ticket #15142: dont_cache_test_views.diff
File dont_cache_test_views.diff, 1.9 KB (added by , 14 years ago) |
---|
-
django/contrib/auth/tests/urls.py
4 4 from django.contrib.auth.decorators import login_required 5 5 from django.http import HttpResponse 6 6 from django.template import Template, RequestContext 7 from django.views.decorators.cache import never_cache 7 8 9 @never_cache 8 10 def remote_user_auth_view(request): 9 11 "Dummy view for remote user tests" 10 12 t = Template("Username is {{ user }}.") -
django/contrib/messages/tests/urls.py
5 5 from django.shortcuts import render_to_response, redirect 6 6 from django.template import RequestContext, Template 7 7 from django.template.response import TemplateResponse 8 from django.views.decorators.cache import never_cache 8 9 9 10 TEMPLATE = """{% if messages %} 10 11 <ul class="messages"> … … 17 18 {% endif %} 18 19 """ 19 20 21 @never_cache 20 22 def add(request, message_type): 21 23 # don't default to False here, because we want to test that it defaults 22 24 # to False if unspecified … … 31 33 show_url = reverse('django.contrib.messages.tests.urls.show') 32 34 return HttpResponseRedirect(show_url) 33 35 36 @never_cache 34 37 def add_template_response(request, message_type): 35 38 for msg in request.POST.getlist('messages'): 36 39 getattr(messages, message_type)(request, msg) … … 38 41 show_url = reverse('django.contrib.messages.tests.urls.show_template_response') 39 42 return HttpResponseRedirect(show_url) 40 43 44 @never_cache 41 45 def show(request): 42 46 t = Template(TEMPLATE) 43 47 return HttpResponse(t.render(RequestContext(request))) 44 48 49 @never_cache 45 50 def show_template_response(request): 46 51 return TemplateResponse(request, Template(TEMPLATE)) 47 52