settings: Rework the LESS_GENERATOR removal warning for easy extension

Setting migration is something that will happen for multiple settings,
and the more we can standardize the reporting procedure, the easier it
will be to add new warnings.
This commit is contained in:
W. Trevor King 2013-03-24 10:13:52 -04:00
commit 1d4d86c876

View file

@ -210,11 +210,6 @@ def configure_settings(settings):
'http://docs.getpelican.com/en/latest/settings.html#timezone ' 'http://docs.getpelican.com/en/latest/settings.html#timezone '
'for more information') 'for more information')
if 'LESS_GENERATOR' in settings:
logger.warning(
'The LESS_GENERATOR setting has been removed in favor '
'of the Webassets plugin')
if 'OUTPUT_SOURCES_EXTENSION' in settings: if 'OUTPUT_SOURCES_EXTENSION' in settings:
if not isinstance(settings['OUTPUT_SOURCES_EXTENSION'], if not isinstance(settings['OUTPUT_SOURCES_EXTENSION'],
six.string_types): six.string_types):
@ -256,4 +251,13 @@ def configure_settings(settings):
% PATH_KEY) % PATH_KEY)
settings[PATH_KEY] = DEFAULT_CONFIG[PATH_KEY] settings[PATH_KEY] = DEFAULT_CONFIG[PATH_KEY]
for old,new,doc in [
('LESS_GENERATOR', 'the Webassets plugin', None),
]:
if old in settings:
message = 'The {} setting has been removed in favor of {}'
if doc:
message += ', see {} for details'
logger.warning(message)
return settings return settings