# HG changeset patch # User Mads Kiilerich # Date 2020-04-24 13:17:00 # Node ID 27d9ca0c83815178bb647055436e59383e7a68ea # Parent 0619fe53ff6d7747ff6c369702d470c64d21d547 tg: use FullStackApplicationConfigurator instead of deprecated setup_tg_wsgi_app and AppConfig diff --git a/kallithea/config/app_cfg.py b/kallithea/config/app_cfg.py --- a/kallithea/config/app_cfg.py +++ b/kallithea/config/app_cfg.py @@ -28,7 +28,7 @@ import tg from alembic.migration import MigrationContext from alembic.script.base import ScriptDirectory from sqlalchemy import create_engine -from tg.configuration import AppConfig +from tg import FullStackApplicationConfigurator import kallithea.lib.locale import kallithea.model.base @@ -47,7 +47,9 @@ from kallithea.model import db log = logging.getLogger(__name__) -base_config = AppConfig(**{ +base_config = FullStackApplicationConfigurator() + +base_config.update_blueprint({ 'package': kallithea, # Rendering Engines Configuration @@ -189,4 +191,4 @@ def setup_application(app): return app -tg.hooks.register('before_config', setup_application) +tg.hooks.register('before_wsgi_middlewares', setup_application) diff --git a/kallithea/config/application.py b/kallithea/config/application.py --- a/kallithea/config/application.py +++ b/kallithea/config/application.py @@ -18,22 +18,14 @@ from kallithea.config.app_cfg import bas __all__ = ['make_app'] -load_environment = base_config.make_load_environment() -# Use base_config to setup the necessary PasteDeploy application factory. -# make_base_app will wrap the TurboGears2 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): +def make_app(global_conf, **app_conf): """ Set up Kallithea with the settings found in the PasteDeploy configuration file used. :param global_conf: The global settings for Kallithea (those defined under the ``[DEFAULT]`` section). - :type global_conf: dict - :param full_stack: Should the whole TurboGears2 stack be set up? - :type full_stack: str or bool :return: The Kallithea application with all the relevant middleware loaded. @@ -44,4 +36,5 @@ def make_app(global_conf, full_stack=Tru """ assert app_conf.get('sqlalchemy.url') # must be called with a Kallithea .ini file, which for example must have this config option assert global_conf.get('here') and global_conf.get('__file__') # app config should be initialized the paste way ... - return make_base_app(global_conf, full_stack=full_stack, **app_conf) + + return base_config.make_wsgi_app(global_conf, app_conf, wrap_app=None)