Made a simple template rendering view and switched a bunch of code over to using it
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 5 Jun 2011 20:58:35 +0000 (15:58 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 5 Jun 2011 20:58:35 +0000 (15:58 -0500)
mediagoblin/auth/routing.py
mediagoblin/auth/views.py
mediagoblin/submit/routing.py
mediagoblin/views.py

index a8909fbb615848a75de2a82cd9ca8e67cf4a3255..46c585d2c30944baa29c42ce5c22771af1571309 100644 (file)
@@ -20,7 +20,8 @@ auth_routes = [
     Route('mediagoblin.auth.register', '/register/',
           controller='mediagoblin.auth.views:register'),
     Route('mediagoblin.auth.register_success', '/register/success/',
-          controller='mediagoblin.auth.views:register_success'),
+          template='mediagoblin/auth/register_success.html',
+          controller='mediagoblin.views:simple_template_render'),
     Route('mediagoblin.auth.login', '/login/',
           controller='mediagoblin.auth.views:login'),
     Route('mediagoblin.auth.logout', '/logout/',
@@ -28,9 +29,11 @@ auth_routes = [
     Route('mediagoblin.auth.verify_email', '/verify_email/',
           controller='mediagoblin.auth.views:verify_email'),
     Route('mediagoblin.auth.verify_email_notice', '/verification_required/',
-          controller='mediagoblin.auth.views:verify_email_notice'),
+          template='mediagoblin/auth/verification_needed.html',
+          controller='mediagoblin.views:simple_template_render'),
     Route('mediagoblin.auth.resend_verification', '/resend_verification/',
           controller='mediagoblin.auth.views:resend_activation'),
     Route('mediagoblin.auth.resend_verification_success',
           '/resend_verification_success/',
-          controller='mediagoblin.auth.views:resend_activation_success')]
+          template='mediagoblin/auth/resent_verification_email.html',
+          controller='mediagoblin.views:simple_template_render')]
index 94a622258bb72d1225c13d0da856bd43656b30d6..1d00f382448de00c8113a9366e71914792f3b95a 100644 (file)
@@ -62,12 +62,6 @@ def register(request):
         {'register_form': register_form})
 
 
-def register_success(request):
-    return render_to_response(
-        request,
-        'mediagoblin/auth/register_success.html', {})
-
-
 def login(request):
     """
     MediaGoblin login view.
@@ -141,16 +135,6 @@ def verify_email(request):
         {'user': user,
          'verification_successful': verification_successful})
 
-def verify_email_notice(request):
-    """
-    Verify warning view.
-
-    When the user tries to do some action that requires their account
-    to be verified beforehand, this view is called upon!
-    """
-    return render_to_response(
-        request, 'mediagoblin/auth/verification_needed.html', {})
-
 
 def resend_activation(request):
     """
@@ -158,15 +142,9 @@ def resend_activation(request):
 
     Resend the activation email.
     """
-
     request.user['verification_key'] = unicode(uuid.uuid4())
     request.user.save()
 
     send_verification_email(request.user, request)
 
     return redirect(request, 'mediagoblin.auth.resend_verification_success')
-
-
-def resend_activation_success(request):
-    return render_to_response(
-        request, 'mediagoblin/auth/resent_verification_email.html', {})
index cff28acb2f48b37cbb4cc7fc9954f08ffe178f24..3edbab707126304fcb611191eb6a16b68629d1c1 100644 (file)
@@ -20,5 +20,5 @@ submit_routes = [
     Route('mediagoblin.submit.start', '/',
           controller='mediagoblin.submit.views:submit_start'),
     Route('mediagoblin.submit.success', '/success/',
-          controller='mediagoblin.submit.views:submit_success'),
-    ]
+          template='mediagoblin/submit/success.html',
+          controller='mediagoblin.views:simple_template_render')]
index 3bff397496360f4c9865fa347056087dbdd9efea..5b6d9773d200e3adca58d95fb63a2cc0fc52db4c 100644 (file)
@@ -22,6 +22,15 @@ def root_view(request):
         {u'state': u'processed'}).sort('created', DESCENDING)
     
     return render_to_response(
-        request,
-        'mediagoblin/root.html',
+        request, 'mediagoblin/root.html',
         {'media_entries': media_entries})
+
+
+def simple_template_render(request):
+    """
+    A view for absolutely simple template rendering.
+    Just make sure 'template' is in the matchdict!
+    """
+    template_name = request.matchdict['template']
+    return render_to_response(
+        request, template_name, {})