diff --git a/sigal/settings.py b/sigal/settings.py index 0c8bdf6..68606a1 100644 --- a/sigal/settings.py +++ b/sigal/settings.py @@ -132,7 +132,9 @@ def read_settings(filename=None): # Make the paths relative to the settings file paths = ['source', 'destination', 'watermark'] - if os.path.isdir(join(settings_path, settings['theme'])): + if os.path.isdir(join(settings_path, settings['theme'])) and \ + os.path.isdir(join(settings_path, settings['theme'], + 'templates')): paths.append('theme') enc = locale.getpreferredencoding() if PY2 else None diff --git a/sigal/writer.py b/sigal/writer.py index 13cf5a8..9f5cc06 100644 --- a/sigal/writer.py +++ b/sigal/writer.py @@ -53,7 +53,8 @@ class Writer(object): self.logger = logging.getLogger(__name__) # search the theme in sigal/theme if the given one does not exists - if not os.path.exists(self.theme): + if not os.path.exists(self.theme) or \ + not os.path.exists(os.path.join(self.theme, 'templates')): self.theme = os.path.join(THEMES_PATH, self.theme) if not os.path.exists(self.theme): raise Exception("Impossible to find the theme %s" % self.theme) diff --git a/tests/test_settings.py b/tests/test_settings.py index b763d13..8bd0cd8 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -48,6 +48,7 @@ def test_theme_path(tmpdir): """Test that image size is swaped if needed.""" tmpdir.join('theme').mkdir() + tmpdir.join('theme').join('templates').mkdir() conf = tmpdir.join('sigal.conf.py') conf.write("""# -*- coding: utf-8 -*-