allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject [allura] 03/12: [#8273] TG 2.3.0: root override; appconfig
Date Tue, 09 Apr 2019 17:02:38 GMT
This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit c1e218c8211b369689bd6e9991607db0de09b887
Author: Dave Brondsema <dave@brondsema.net>
AuthorDate: Thu Mar 21 12:13:17 2019 -0400

    [#8273] TG 2.3.0: root override; appconfig
---
 Allura/allura/config/app_cfg.py    | 15 +++++++++------
 Allura/allura/config/middleware.py |  8 ++------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/Allura/allura/config/app_cfg.py b/Allura/allura/config/app_cfg.py
index c21af19..cc26995 100644
--- a/Allura/allura/config/app_cfg.py
+++ b/Allura/allura/config/app_cfg.py
@@ -52,24 +52,26 @@ log = logging.getLogger(__name__)
 
 class ForgeConfig(AppConfig):
 
-    def __init__(self, root_controller='root'):
-        AppConfig.__init__(self)
-        self.root_controller = root_controller
+    def __init__(self, root_controller=None):
+        AppConfig.__init__(self, minimal=True, root_controller=root_controller)
         self.package = allura
         self.renderers = ['json', 'genshi', 'mako', 'jinja']
-        self.default_renderer = 'genshi'
+        self.default_renderer = 'jinja'
         self.use_sqlalchemy = False
-        self.use_toscawidgets = True
+        self.use_toscawidgets = False
         self.use_transaction_manager = False
+        self.enable_routes = True
         self.handle_status_codes = [403, 404]
         self.disable_request_extensions = True
 
     def after_init_config(self):
         config['tg.strict_tmpl_context'] = True
 
+    def setup_routes(self):
         map = Mapper()
         # Setup a default route for the root of object dispatch
-        map.connect('*url', controller=self.root_controller,
+        # tg.root_controller is set by AppConfig.__init__
+        map.connect('*url', controller=self.get('tg.root_controller', 'root'),
                     action='routes_placeholder')
         config['routes.map'] = map
 
@@ -132,4 +134,5 @@ class JinjaEngine(ew.TemplateEngine):
             text = template.render(**context)
             return literal(text)
 
+
 base_config = ForgeConfig()
diff --git a/Allura/allura/config/middleware.py b/Allura/allura/config/middleware.py
index decce40..21e78b4 100644
--- a/Allura/allura/config/middleware.py
+++ b/Allura/allura/config/middleware.py
@@ -62,13 +62,9 @@ from allura.lib import helpers as h
 
 __all__ = ['make_app']
 
-# Use base_config to setup the necessary PasteDeploy application factory.
-# make_base_app will wrap the TG2 app with all the middleware it needs.
-make_base_app = base_config.setup_tg_wsgi_app(load_environment)
-
 
 def make_app(global_conf, full_stack=True, **app_conf):
-    root = app_conf.get('override_root', 'root')
+    root = app_conf.get('override_root', None)
     return _make_core_app(root, global_conf, full_stack, **app_conf)
 
 
@@ -173,7 +169,7 @@ def _make_core_app(root, global_conf, full_stack=True, **app_conf):
     app = RegistryManager(app, streaming=True)
 
     # "task" wsgi would get a 2nd request to /error/document if we used this middleware
-    if config.get('override_root') != 'task':
+    if config.get('override_root') not in ('task', 'basetest_project_root'):
         # Converts exceptions to HTTP errors, shows traceback in debug mode
         # don't use TG footer with extra CSS & images that take time to load
         tg.error.footer_html = '<!-- %s %s -->'


Mime
View raw message