changeset 6596:304aae43194c

gearbox: fix setup-db failure when db is created for the first time (Issue #272) The port to TG2 in e1ab82613133 replaced pylonsconfig.init_app for gearbox commands with middleware setup code. That introduced reading of the database for commands that don't need a database - for example the command for creating databases ... which thus failed. To fix that, move the middleware setup with database access so it only is run for gearbox command that requires a db session. There is apparently no need for a direct replacement for pylonsconfig.init_app .
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 14 Apr 2017 21:30:42 +0200
parents 21d210d29d7f
children a1f8bf0428c5
files kallithea/lib/paster_commands/common.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/paster_commands/common.py	Fri Apr 14 21:19:42 2017 +0200
+++ b/kallithea/lib/paster_commands/common.py	Fri Apr 14 21:30:42 2017 +0200
@@ -71,9 +71,9 @@
             path_to_ini_file = os.path.realpath(args.config_file)
             conf = paste.deploy.appconfig('config:' + path_to_ini_file)
             logging.config.fileConfig(path_to_ini_file)
-            kallithea.config.middleware.make_app_without_logging(conf.global_conf, **conf.local_conf)
 
             if self.requires_db_session:
+                kallithea.config.middleware.make_app_without_logging(conf.global_conf, **conf.local_conf)
                 kallithea.lib.utils.setup_cache_regions(config)
                 engine = kallithea.lib.utils2.engine_from_config(config, 'sqlalchemy.')
                 kallithea.model.base.init_model(engine)