Simplified configuration option to be more flexible

As @ametaireau suggested: instead of having logic that prepends the
OUTPUT_SOURCES_EXTENSION with a '.' we allow the user more
flexibility to control the extension that can be used.
This commit is contained in:
Nico Di Rocco 2012-10-03 22:06:45 +02:00
commit c53a06a5d5
2 changed files with 4 additions and 9 deletions

View file

@ -177,15 +177,10 @@ def configure_settings(settings, default_settings=None, filename=None):
settings['WEBASSETS'] = False
if 'OUTPUT_SOURCES_EXTENSION' in settings:
try:
if not isinstance(settings['OUTPUT_SOURCES_EXTENSION'], str):
raise ValueError
elif '.' is not settings['OUTPUT_SOURCES_EXTENSION'][0]:
settings['OUTPUT_SOURCES_EXTENSION'] = '.' + settings['OUTPUT_SOURCES_EXTENSION']
except(ValueError, IndexError):
if not isinstance(settings['OUTPUT_SOURCES_EXTENSION'], str):
settings['OUTPUT_SOURCES_EXTENSION'] = _DEFAULT_CONFIG['OUTPUT_SOURCES_EXTENSION']
logger.warn("Detected misconfiguration with OUTPUT_SOURCES_EXTENSION."
" falling back to the default extension " +
_DEFAULT_CONFIG['OUTPUT_SOURCES_EXTENSION'])
settings['OUTPUT_SOURCES_EXTENSION'] = _DEFAULT_CONFIG['OUTPUT_SOURCES_EXTENSION']
return settings