Create render_to_reponse and use it everywhere.

Just a shortcut for Response(render_template(...))
This commit is contained in:
Elrond
2011-06-05 15:25:45 +02:00
parent 99619a625b
commit 1c63ad5d35
6 changed files with 39 additions and 47 deletions

View File

@@ -16,9 +16,9 @@
import uuid
from webob import Response, exc
from webob import exc
from mediagoblin.util import render_template
from mediagoblin.util import render_to_response
from mediagoblin.db.util import ObjectId
from mediagoblin.auth import lib as auth_lib
from mediagoblin.auth import forms as auth_forms
@@ -59,16 +59,14 @@ def register(request):
location=request.urlgen("mediagoblin.auth.register_success"))
# render
return Response(
render_template(
return render_to_response(
request, 'mediagoblin/auth/register.html',
{'register_form': register_form}))
{'register_form': register_form})
def register_success(request):
return Response(
render_template(
request, 'mediagoblin/auth/register_success.html', {}))
return render_to_response(
request, 'mediagoblin/auth/register_success.html', {})
def login(request):
@@ -103,12 +101,11 @@ def login(request):
login_failed = True
# render
return Response(
render_template(
return render_to_response(
request, 'mediagoblin/auth/login.html',
{'login_form': login_form,
'next': request.GET.get('next') or request.POST.get('next'),
'login_failed': login_failed}))
'login_failed': login_failed})
def logout(request):
@@ -141,11 +138,10 @@ def verify_email(request):
else:
verification_successful = False
return Response(
render_template(
return render_to_response(
request, 'mediagoblin/auth/verify_email.html',
{'user': user,
'verification_successful': verification_successful}))
'verification_successful': verification_successful})
def verify_email_notice(request):
"""
@@ -154,9 +150,8 @@ def verify_email_notice(request):
When the user tries to do some action that requires their account
to be verified beforehand, this view is called upon!
"""
return Response(
render_template(
request, 'mediagoblin/auth/verification_needed.html', {}))
return render_to_response(
request, 'mediagoblin/auth/verification_needed.html', {})
def resend_activation(request):
@@ -176,6 +171,5 @@ def resend_activation(request):
def resend_activation_success(request):
return Response(
render_template(
request, 'mediagoblin/auth/resent_verification_email.html', {}))
return render_to_response(
request, 'mediagoblin/auth/resent_verification_email.html', {})