fixed bug with loading theme twice
This commit is contained in:
parent
21a6781a53
commit
32db7870e3
2 changed files with 6 additions and 17 deletions
|
@ -61,7 +61,7 @@ _DEFAULT_SIGAL_SETTINGS = {
|
|||
'SIGAL_ORIG_LINK': False,
|
||||
# 'PLUGINS': [],
|
||||
# 'PLUGIN_PATHS': [],
|
||||
'SIGAL_SOURCE': 'sigal',
|
||||
'SIGAL_SOURCE': 'siglican',
|
||||
'SIGAL_THEME': 'colorbox',
|
||||
'SIGAL_THUMB_DIR': 'thumbs',
|
||||
'SIGAL_THUMB_FIT': True,
|
||||
|
@ -244,8 +244,8 @@ class SigalGalleryGenerator(Generator):
|
|||
self.theme = self.settings['SIGAL_THEME']
|
||||
default_themes = os.path.normpath(os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)), 'themes'))
|
||||
logger.debug("siglican: custom theme: %s", self.theme)
|
||||
logger.debug("siglican: default themedir: %s", default_themes)
|
||||
#logger.debug("siglican: custom theme: %s", self.theme)
|
||||
#logger.debug("siglican: default themedir: %s", default_themes)
|
||||
if not os.path.exists(self.theme):
|
||||
self.theme = os.path.join(default_themes, os.path.basename(self.theme))
|
||||
if not os.path.exists(self.theme):
|
||||
|
@ -253,7 +253,6 @@ class SigalGalleryGenerator(Generator):
|
|||
os.path.basename(self.theme))
|
||||
|
||||
logger.info("siglican theme: %s", self.theme)
|
||||
theme_relpath = os.path.join(self.theme, 'templates')
|
||||
|
||||
## note 1: it's impossible to add additional templates to jinja
|
||||
## after the initial init, which means we either need to put plugin
|
||||
|
|
16
writer.py
16
writer.py
|
@ -43,7 +43,7 @@ from .utils import url_from_path
|
|||
class Writer(object):
|
||||
"""Generate html pages for each directory of images."""
|
||||
|
||||
def __init__(self, settings, theme=None, index_title=''):
|
||||
def __init__(self, settings, theme, index_title=''):
|
||||
self.settings = settings
|
||||
self.output_dir = settings['SIGAL_DESTINATION']
|
||||
self.index_title = index_title
|
||||
|
@ -51,21 +51,11 @@ class Writer(object):
|
|||
|
||||
# check for a custom theme in ./sigal/themes, if not found, look for a
|
||||
# default in the sigal_theme/themes plugin directory
|
||||
self.theme = settings['SIGAL_THEME']
|
||||
default_themes = os.path.normpath(os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)), 'themes'))
|
||||
self.logger.debug("siglican: custom theme: %s", self.theme)
|
||||
self.logger.debug("siglican: default themedir: %s", default_themes)
|
||||
if not os.path.exists(self.theme):
|
||||
self.theme = os.path.join(default_themes, os.path.basename(self.theme))
|
||||
if not os.path.exists(self.theme):
|
||||
raise Exception("siglican: unable to find theme: %s" %
|
||||
os.path.basename(self.theme))
|
||||
|
||||
self.logger.info("siglican theme: %s", self.theme)
|
||||
self.logger.info("siglican theme: %s", theme)
|
||||
|
||||
# pelican theme path merged with siglican theme path
|
||||
theme_paths = [ os.path.join(self.theme, 'templates'),
|
||||
theme_paths = [ os.path.join(theme, 'templates'),
|
||||
os.path.join(self.settings['THEME'], 'templates') ]
|
||||
|
||||
# setup jinja env
|
||||
|
|
Loading…
Reference in a new issue