Removed trailing whitespace.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6046 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Gary Wilson Jr 2007-09-04 00:54:40 +00:00
parent 2292ebb47f
commit 4e476b44af
1 changed files with 22 additions and 22 deletions

View File

@ -12,7 +12,7 @@ def get_view(request):
"A simple view that expects a GET request, and returns a rendered template" "A simple view that expects a GET request, and returns a rendered template"
t = Template('This is a test. {{ var }} is the value.', name='GET Template') t = Template('This is a test. {{ var }} is the value.', name='GET Template')
c = Context({'var': request.GET.get('var', 42)}) c = Context({'var': request.GET.get('var', 42)})
return HttpResponse(t.render(c)) return HttpResponse(t.render(c))
def post_view(request): def post_view(request):
@ -29,9 +29,9 @@ def post_view(request):
else: else:
t = Template('Viewing GET page.', name='Empty GET Template') t = Template('Viewing GET page.', name='Empty GET Template')
c = Context() c = Context()
return HttpResponse(t.render(c)) return HttpResponse(t.render(c))
def raw_post_view(request): def raw_post_view(request):
"""A view which expects raw XML to be posted and returns content extracted """A view which expects raw XML to be posted and returns content extracted
from the XML""" from the XML"""
@ -78,7 +78,7 @@ class TestForm(Form):
value = fields.IntegerField() value = fields.IntegerField()
single = fields.ChoiceField(choices=TestChoices) single = fields.ChoiceField(choices=TestChoices)
multi = fields.MultipleChoiceField(choices=TestChoices) multi = fields.MultipleChoiceField(choices=TestChoices)
def form_view(request): def form_view(request):
"A view that tests a simple form" "A view that tests a simple form"
if request.method == 'POST': if request.method == 'POST':
@ -93,7 +93,7 @@ def form_view(request):
form = TestForm(request.GET) form = TestForm(request.GET)
t = Template('Viewing base form. {{ form }}.', name='Form GET Template') t = Template('Viewing base form. {{ form }}.', name='Form GET Template')
c = Context({'form': form}) c = Context({'form': form})
return HttpResponse(t.render(c)) return HttpResponse(t.render(c))
def form_view_with_template(request): def form_view_with_template(request):
@ -107,26 +107,26 @@ def form_view_with_template(request):
else: else:
form = TestForm() form = TestForm()
message = 'GET form page' message = 'GET form page'
return render_to_response('form_view.html', return render_to_response('form_view.html',
{ {
'form': form, 'form': form,
'message': message 'message': message
} }
) )
def login_protected_view(request): def login_protected_view(request):
"A simple view that is login protected." "A simple view that is login protected."
t = Template('This is a login protected test. Username is {{ user.username }}.', name='Login Template') t = Template('This is a login protected test. Username is {{ user.username }}.', name='Login Template')
c = Context({'user': request.user}) c = Context({'user': request.user})
return HttpResponse(t.render(c)) return HttpResponse(t.render(c))
login_protected_view = login_required(login_protected_view) login_protected_view = login_required(login_protected_view)
def session_view(request): def session_view(request):
"A view that modifies the session" "A view that modifies the session"
request.session['tobacconist'] = 'hovercraft' request.session['tobacconist'] = 'hovercraft'
t = Template('This is a view that modifies the session.', t = Template('This is a view that modifies the session.',
name='Session Modifying View Template') name='Session Modifying View Template')
c = Context() c = Context()
return HttpResponse(t.render(c)) return HttpResponse(t.render(c))
@ -137,25 +137,25 @@ def broken_view(request):
def mail_sending_view(request): def mail_sending_view(request):
EmailMessage( EmailMessage(
"Test message", "Test message",
"This is a test email", "This is a test email",
"from@example.com", "from@example.com",
['first@example.com', 'second@example.com']).send() ['first@example.com', 'second@example.com']).send()
return HttpResponse("Mail sent") return HttpResponse("Mail sent")
def mass_mail_sending_view(request): def mass_mail_sending_view(request):
m1 = EmailMessage( m1 = EmailMessage(
'First Test message', 'First Test message',
'This is the first test email', 'This is the first test email',
'from@example.com', 'from@example.com',
['first@example.com', 'second@example.com']) ['first@example.com', 'second@example.com'])
m2 = EmailMessage( m2 = EmailMessage(
'Second Test message', 'Second Test message',
'This is the second test email', 'This is the second test email',
'from@example.com', 'from@example.com',
['second@example.com', 'third@example.com']) ['second@example.com', 'third@example.com'])
c = SMTPConnection() c = SMTPConnection()
c.send_messages([m1,m2]) c.send_messages([m1,m2])
return HttpResponse("Mail sent") return HttpResponse("Mail sent")