Changeset - 27d9ca0c8381
[Not reviewed]
default
0 2 0
Mads Kiilerich (mads) - 6 years ago 2020-04-24 13:17:00
mads@kiilerich.com
Grafted from: 2d7900d45e27
tg: use FullStackApplicationConfigurator instead of deprecated setup_tg_wsgi_app and AppConfig
2 files changed with 8 insertions and 13 deletions:
0 comments (0 inline, 0 general)
kallithea/config/app_cfg.py
Show inline comments
 
@@ -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)
kallithea/config/application.py
Show inline comments
 
@@ -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)
0 comments (0 inline, 0 general)