More robust plugin list in conf

A single plugin name or an absence of it, with or without comma,
is now properly handled.

Related: #18
main
Fabien Benureau 9 years ago
parent f843aebcbd
commit aa521576f5

@ -68,8 +68,9 @@ pages = string(default='')
[plugins] [plugins]
# comma-separated list of the plugins to load # Comma-separated list of the plugins to load.
active = list(default=list()) # The only current available plugin is alias.
active = force_list(default=list('alias'))
[[alias]] [[alias]]
# new subcommands can be defined, e.g.: # new subcommands can be defined, e.g.:

@ -35,7 +35,8 @@ def load_plugins(conf, ui):
PapersPlugin subclasses desired. PapersPlugin subclasses desired.
""" """
for name in conf['plugins']['active']: for name in conf['plugins']['active']:
modname = '%s.%s.%s.%s' % ('pubs', PLUGIN_NAMESPACE, name, name) if len(name) > 0:
modname = '{}.{}.{}.{}'.format('pubs', PLUGIN_NAMESPACE, name, name)
try: try:
namespace = importlib.import_module(modname) namespace = importlib.import_module(modname)
except ImportError as exc: except ImportError as exc:

Loading…
Cancel
Save