Mercurial > piecrust2
changeset 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 | c7e9001c74c2 |
children | 10bb8e8600f5 |
files | piecrust/app.py |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/piecrust/app.py Wed Mar 25 23:04:42 2015 -0700 +++ b/piecrust/app.py Fri Mar 27 20:04:17 2015 -0700 @@ -28,7 +28,7 @@ logger = logging.getLogger(__name__) -CACHE_VERSION = 16 +CACHE_VERSION = 17 class VariantNotFoundError(Exception): @@ -368,6 +368,16 @@ "Source '%s' is using a reserved endpoint name: %s" % (name, endpoint)) + # Make sure the `plugins` setting is a list. + user_plugins = sitec.get('plugins') + if user_plugins: + if isinstance(user_plugins, str): + sitec['plugins'] = user_plugins.split(',') + elif not isinstance(user_plugins, list): + raise ConfigurationError( + "The 'site/plugins' setting must be an array, or a " + "comma-separated list.") + # Done validating! return values