Mercurial > piecrust2
changeset 910:371731b555ec
plugins: Fix a crash bug when the plugins directory doesn't exist.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 23 Jul 2017 18:01:58 -0700 |
parents | eed19a80c00e |
children | f2b75e4be981 |
files | piecrust/plugins/base.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/piecrust/plugins/base.py Sun Jul 23 18:01:26 2017 -0700 +++ b/piecrust/plugins/base.py Sun Jul 23 18:01:58 2017 -0700 @@ -117,7 +117,8 @@ if to_install: for name in to_install: plugin = self._loadPlugin(name) - self._plugins.append(plugin) + if plugin is not None: + self._plugins.append(plugin) for plugin in self._plugins: plugin.initialize(self.app) @@ -130,7 +131,7 @@ except ImportError as ex: mod = None - if mod is None: + if mod is None and self.app.plugins_dir: # Import as a loose Python file from the plugins dir. pfile = os.path.join(self.app.plugins_dir, plugin_name + '.py') if os.path.isfile(pfile):