Tweak how tailbone finds rattail config from pyramid settings

Eventually need to stop supporting the old 'edbob.config' setting, for
now keep it as a fallback.
This commit is contained in:
Lance Edgar 2016-10-08 14:29:23 -05:00
parent fca95ae8c0
commit b5cea62de7

View file

@ -59,12 +59,16 @@ def make_rattail_config(settings):
rattail_config = settings.get('rattail_config')
if not rattail_config:
# Initialize rattail config and embed it in the settings dict, to make it
# available to web requests later.
path = settings.get('edbob.config')
# initialize rattail config and embed in settings dict, to make
# available for web requests later
path = settings.get('rattail.config')
if not path or not os.path.exists(path):
raise ConfigurationError("Please set 'edbob.config' in [app:main] section of config "
"to the path of your config file. Lame, but necessary.")
path = settings.get('edbob.config')
if not path or not os.path.exists(path):
raise ConfigurationError("Please set 'rattail.config' in [app:main] section of config "
"to the path of your config file. Lame, but necessary.")
log.warning("using fallback 'edbob.config' setting, but would prefer the "
"'rattail.config' setting under [app:main] if possible...")
rattail_config = make_config(path)
settings['rattail_config'] = rattail_config
rattail_config.configure_logging()