Have the hook handle happen in the root_view proxy view itself
authorChristopher Allan Webber <cwebber@dustycloud.org>
Tue, 14 Jan 2014 18:13:36 +0000 (12:13 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Tue, 14 Jan 2014 18:13:36 +0000 (12:13 -0600)
This way it isn't set in stone at a module level, especially if this
gets imported before the whole application inits, or if run during
tests and possibly imported multiple times.

mediagoblin/views.py

index 12b1b386af4770eca95468636f3ae7ba0768e909..009e48e48b510edd54e1a840e60828b1236a78c3 100644 (file)
@@ -37,6 +37,16 @@ def default_root_view(request, page):
          'pagination': pagination})
 
 
+
+def root_view(request):
+    """
+    Proxies to the real root view that's displayed
+    """
+    view = hook_handle("frontpage_view") or default_root_view
+    return view(request)
+
+
+
 def simple_template_render(request):
     """
     A view for absolutely simple template rendering.
@@ -52,5 +62,3 @@ def terms_of_service(request):
 
     return render_to_response(request,
         'mediagoblin/terms_of_service.html', {})
-
-root_view = hook_handle("frontpage_view") or default_root_view