# HG changeset patch # User Marcin Kuzminski # Date 2017-11-10 12:38:58 # Node ID 79804d6ecd5279708ff1b67b401be9046c1690fa # Parent 3ce9ef8ce89ab57c1baa4d632c6e5f348c28a711 pyramid-utils: add helper to fetch application config. - does 'here' interpolation properly diff --git a/rhodecode/lib/pyramid_utils.py b/rhodecode/lib/pyramid_utils.py --- a/rhodecode/lib/pyramid_utils.py +++ b/rhodecode/lib/pyramid_utils.py @@ -18,17 +18,23 @@ # RhodeCode Enterprise Edition, including its added features, Support services, # and proprietary license terms, please see https://rhodecode.com/licenses/ +import os import ConfigParser from pyramid.paster import bootstrap as pyramid_bootstrap from pyramid.request import Request -def get_config(ini_path): - parser = ConfigParser.ConfigParser() +def get_config(ini_path, **kwargs): + parser = ConfigParser.ConfigParser(**kwargs) parser.read(ini_path) return parser +def get_app_config(ini_path): + from paste.deploy.loadwsgi import appconfig + return appconfig('config:{}'.format(ini_path), relative_to=os.getcwd()) + + def bootstrap(config_uri, request=None, options=None): config = get_config(config_uri)