changeset 6589:c184df63e470

lib: reduce impact of bad import cycle Follow-up to e0f31c7d0f5e. It is unfortunate that generic lib code depends on kallithea.lib.paster_commands.common - it would make more sense if it was the other way around. We thus move the import down to inside the function that needs it. The import of kallithea.lib.paster_commands.common in db_manage triggered its import of logging.config . middleware.py thus also got logging.config when it just imported logging and things worked. Without this import of paster_commands, we also have to fix the import in db_manage.
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 13 Apr 2017 02:25:59 +0200
parents 0452c45a546c
children 6e11022b00f8
files kallithea/config/middleware.py kallithea/lib/db_manage.py
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/config/middleware.py	Tue Apr 11 14:37:43 2017 +0200
+++ b/kallithea/config/middleware.py	Thu Apr 13 02:25:59 2017 +0200
@@ -13,7 +13,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """WSGI middleware initialization for the Kallithea application."""
 
-import logging
+import logging.config
 from kallithea.config.app_cfg import base_config
 from kallithea.config.environment import load_environment
 
--- a/kallithea/lib/db_manage.py	Tue Apr 11 14:37:43 2017 +0200
+++ b/kallithea/lib/db_manage.py	Thu Apr 13 02:25:59 2017 +0200
@@ -36,7 +36,6 @@
 import alembic.config
 import alembic.command
 
-from kallithea.lib.paster_commands.common import ask_ok
 from kallithea.model.user import UserModel
 from kallithea.model.base import init_model
 from kallithea.model.db import User, Permission, Ui, \
@@ -78,6 +77,7 @@
         force_ask = self.cli_args.get('force_ask')
         if force_ask is not None:
             return force_ask
+        from kallithea.lib.paster_commands.common import ask_ok
         return ask_ok(msg)
 
     def init_db(self, SESSION=None):