Fixed #5982 -- Changed test client's URL processing to match core's (everything

gets run through urllib.unquote()). Patch from Leo Shklovskii and Russell
Keith-Magee.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7330 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-03-20 06:50:54 +00:00
parent 9e47cc2e51
commit 597f9d6105
5 changed files with 47 additions and 6 deletions

View file

@ -1,7 +1,5 @@
from django.contrib.auth.decorators import login_required
from django.core.mail import EmailMessage, SMTPConnection
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseServerError
from django.shortcuts import render_to_response
def no_template_view(request):
"A simple view that expects a GET request, and returns a rendered template"
@ -20,10 +18,22 @@ def file_upload_view(request):
return HttpResponseServerError()
def get_view(request):
"A simple login protected view"
"A simple login protected view"
return HttpResponse("Hello world")
get_view = login_required(get_view)
def view_with_argument(request, name):
"""A view that takes a string argument
The purpose of this view is to check that if a space is provided in
the argument, the test framework unescapes the %20 before passing
the value to the view.
"""
if name == 'Arthur Dent':
return HttpResponse('Hi, Arthur')
else:
return HttpResponse('Howdy, %s' % name)
def login_protected_redirect_view(request):
"A view that redirects all requests to the GET view"
return HttpResponseRedirect('/test_client_regress/get_view/')