Padding on the header-dropdown area
[mediagoblin.git] / mediagoblin / app.py
index 1137c0d72fffd899af0adfe09193123aba034bc0..580583607f32f2ca3bd7558993ec5900f469ebf2 100644 (file)
@@ -35,8 +35,9 @@ from mediagoblin.init.plugins import setup_plugins
 from mediagoblin.init import (get_jinja_loader, get_staticdirector,
     setup_global_and_app_config, setup_locales, setup_workbench, setup_database,
     setup_storage)
-from mediagoblin.tools.pluginapi import PluginManager
+from mediagoblin.tools.pluginapi import PluginManager, hook_transform
 from mediagoblin.tools.crypto import setup_crypto
+from mediagoblin import notifications
 
 
 _log = logging.getLogger(__name__)
@@ -186,8 +187,11 @@ class MediaGoblinApp(object):
 
         request.urlgen = build_proxy
 
+        request.notifications = notifications
+
         mg_request.setup_user_in_request(request)
 
+        request.controller_name = None
         try:
             found_rule, url_values = map_adapter.match(return_rule=True)
             request.matchdict = url_values
@@ -201,6 +205,9 @@ class MediaGoblinApp(object):
                 exc.get_description(environ))(environ, start_response)
 
         controller = endpoint_to_controller(found_rule)
+        # Make a reference to the controller's symbolic name on the request...
+        # used for lazy context modification
+        request.controller_name = found_rule.endpoint
 
         # pass the request through our meddleware classes
         try:
@@ -227,7 +234,7 @@ class MediaGoblinApp(object):
             for m in self.meddleware[::-1]:
                 m.process_response(request, response)
         except HTTPException as e:
-            response = render_http_exeption(
+            response = render_http_exception(
                 request, e, e.get_description(environ))
 
         session_manager.save_session_to_cookie(request.session,
@@ -259,8 +266,6 @@ def paste_app_factory(global_config, **app_config):
         raise IOError("Usable mediagoblin config not found.")
 
     mgoblin_app = MediaGoblinApp(mediagoblin_config)
-
-    for callable_hook in PluginManager().get_hook_callables('wrap_wsgi'):
-        mgoblin_app = callable_hook(mgoblin_app)
+    mgoblin_app = hook_transform('wrap_wsgi', mgoblin_app)
 
     return mgoblin_app