Avoid ambiguous config key for registered batch handlers
This commit is contained in:
parent
a782e04af1
commit
9720138246
|
@ -602,10 +602,18 @@ class AppHandler(object):
|
||||||
"""
|
"""
|
||||||
# spec is assumed to come from config/settings if present,
|
# spec is assumed to come from config/settings if present,
|
||||||
# otherwise caller-supplied default is assumed
|
# otherwise caller-supplied default is assumed
|
||||||
spec = self.config.get('rattail.batch', '{}.handler'.format(key),
|
spec = self.config.get('rattail.batch', f'{key}.handler.spec')
|
||||||
default=default)
|
|
||||||
if not spec:
|
if not spec:
|
||||||
spec = self.config.get('rattail.batch', '{}.handler.default'.format(key))
|
spec = self.config.get('rattail.batch', f'{key}.handler')
|
||||||
|
if spec:
|
||||||
|
warnings.warn(f"URGENT: instead of 'rattail.batch.{key}.handler', "
|
||||||
|
f"you should set 'rattail.batch.{key}.handler.spec'",
|
||||||
|
DeprecationWarning, stacklevel=2)
|
||||||
|
else:
|
||||||
|
spec = default
|
||||||
|
|
||||||
|
if not spec:
|
||||||
|
spec = self.config.get('rattail.batch', f'{key}.handler.default')
|
||||||
|
|
||||||
# TODO: this probably should go away?
|
# TODO: this probably should go away?
|
||||||
# if none of the above gave us a spec, check for common 'importer' type
|
# if none of the above gave us a spec, check for common 'importer' type
|
||||||
|
|
|
@ -661,6 +661,9 @@ class RattailConfiguration(RattailConfigMixin):
|
||||||
# RattailConfiguration class, only the older RattailConfig!
|
# RattailConfiguration class, only the older RattailConfig!
|
||||||
if not isinstance(value, configuration.Configuration):
|
if not isinstance(value, configuration.Configuration):
|
||||||
return value
|
return value
|
||||||
|
log.warning("ambiguous config key '%s' returns: %s", key, value)
|
||||||
|
warnings.warn(f"ambiguous config key '{key}' returns: {value}",
|
||||||
|
DeprecationWarning, stacklevel=2)
|
||||||
|
|
||||||
# read from db last if so requested
|
# read from db last if so requested
|
||||||
if usedb and not preferdb:
|
if usedb and not preferdb:
|
||||||
|
|
Loading…
Reference in a new issue