[PATCH 1 of 2] config: load_environment option to skip db init

Andrew Shadura andrew at shadura.me
Sat Apr 18 15:54:08 EDT 2015


# HG changeset patch
# User Andrew Shadura <andrew at shadura.me>
# Date 1429302082 -7200
#      Fri Apr 17 22:21:22 2015 +0200
# Node ID d9615df6d46a9c80a0adb3d68e33f1fe091e8127
# Parent  1357a442697c14c8aee05f4cdf76e614350206f8
config: load_environment option to skip db init

diff --git a/kallithea/config/environment.py b/kallithea/config/environment.py
--- a/kallithea/config/environment.py
+++ b/kallithea/config/environment.py
@@ -44,7 +44,8 @@ log = logging.getLogger(__name__)
 
 
 def load_environment(global_conf, app_conf, initial=False,
-                     test_env=None, test_index=None):
+                     test_env=None, test_index=None,
+                     config_only=False):
     """
     Configure the Pylons environment via the ``pylons.config``
     object
@@ -88,6 +89,10 @@ def load_environment(global_conf, app_co
 
     # sets the c attribute access when don't existing attribute are accessed
     config['pylons.strict_tmpl_context'] = True
+
+    if config_only:
+        return config
+
     test = os.path.split(config['__file__'])[-1] == 'test.ini'
     if test:
         if test_env is None:


More information about the kallithea-general mailing list