##// END OF EJS Templates
tg: use FullStackApplicationConfigurator instead of deprecated setup_tg_wsgi_app and AppConfig
Mads Kiilerich -
r8290:27d9ca0c default
parent child Browse files
Show More
@@ -28,7 +28,7 b' import tg'
28 28 from alembic.migration import MigrationContext
29 29 from alembic.script.base import ScriptDirectory
30 30 from sqlalchemy import create_engine
31 from tg.configuration import AppConfig
31 from tg import FullStackApplicationConfigurator
32 32
33 33 import kallithea.lib.locale
34 34 import kallithea.model.base
@@ -47,7 +47,9 b' from kallithea.model import db'
47 47 log = logging.getLogger(__name__)
48 48
49 49
50 base_config = AppConfig(**{
50 base_config = FullStackApplicationConfigurator()
51
52 base_config.update_blueprint({
51 53 'package': kallithea,
52 54
53 55 # Rendering Engines Configuration
@@ -189,4 +191,4 b' def setup_application(app):'
189 191 return app
190 192
191 193
192 tg.hooks.register('before_config', setup_application)
194 tg.hooks.register('before_wsgi_middlewares', setup_application)
@@ -18,22 +18,14 b' from kallithea.config.app_cfg import bas'
18 18
19 19 __all__ = ['make_app']
20 20
21 load_environment = base_config.make_load_environment()
22 # Use base_config to setup the necessary PasteDeploy application factory.
23 # make_base_app will wrap the TurboGears2 app with all the middleware it needs.
24 make_base_app = base_config.setup_tg_wsgi_app(load_environment)
25 21
26
27 def make_app(global_conf, full_stack=True, **app_conf):
22 def make_app(global_conf, **app_conf):
28 23 """
29 24 Set up Kallithea with the settings found in the PasteDeploy configuration
30 25 file used.
31 26
32 27 :param global_conf: The global settings for Kallithea (those
33 28 defined under the ``[DEFAULT]`` section).
34 :type global_conf: dict
35 :param full_stack: Should the whole TurboGears2 stack be set up?
36 :type full_stack: str or bool
37 29 :return: The Kallithea application with all the relevant middleware
38 30 loaded.
39 31
@@ -44,4 +36,5 b' def make_app(global_conf, full_stack=Tru'
44 36 """
45 37 assert app_conf.get('sqlalchemy.url') # must be called with a Kallithea .ini file, which for example must have this config option
46 38 assert global_conf.get('here') and global_conf.get('__file__') # app config should be initialized the paste way ...
47 return make_base_app(global_conf, full_stack=full_stack, **app_conf)
39
40 return base_config.make_wsgi_app(global_conf, app_conf, wrap_app=None)
General Comments 0
You need to be logged in to leave comments. Login now