Enhance detection of a theme directory.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 -*-
|
||||
|
||||
|
||||
Reference in New Issue
Block a user