comparison piecrust/app.py @ 311:47ffac7ab25d

config: Make sure `site/plugins` is transformed into a list.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 27 Mar 2015 20:04:17 -0700
parents 869a206facd5
children edcc9dc17b37
comparison
equal deleted inserted replaced
310:c7e9001c74c2 311:47ffac7ab25d
26 26
27 27
28 logger = logging.getLogger(__name__) 28 logger = logging.getLogger(__name__)
29 29
30 30
31 CACHE_VERSION = 16 31 CACHE_VERSION = 17
32 32
33 33
34 class VariantNotFoundError(Exception): 34 class VariantNotFoundError(Exception):
35 def __init__(self, variant_path, message=None): 35 def __init__(self, variant_path, message=None):
36 super(VariantNotFoundError, self).__init__( 36 super(VariantNotFoundError, self).__init__(
366 if endpoint in reserved_endpoints: 366 if endpoint in reserved_endpoints:
367 raise ConfigurationError( 367 raise ConfigurationError(
368 "Source '%s' is using a reserved endpoint name: %s" % 368 "Source '%s' is using a reserved endpoint name: %s" %
369 (name, endpoint)) 369 (name, endpoint))
370 370
371 # Make sure the `plugins` setting is a list.
372 user_plugins = sitec.get('plugins')
373 if user_plugins:
374 if isinstance(user_plugins, str):
375 sitec['plugins'] = user_plugins.split(',')
376 elif not isinstance(user_plugins, list):
377 raise ConfigurationError(
378 "The 'site/plugins' setting must be an array, or a "
379 "comma-separated list.")
380
371 # Done validating! 381 # Done validating!
372 return values 382 return values
373 383
374 384
375 class PieCrust(object): 385 class PieCrust(object):