mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
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:
parent
9e47cc2e51
commit
597f9d6105
5 changed files with 47 additions and 6 deletions
|
@ -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/')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue