Skip to content

Commit 17c69cf

Browse files
committedJan 12, 2015
Check if theme inherits from bootstrap3 and change if needed.
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
1 parent ecb6367 commit 17c69cf

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed
 

‎comet/web.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ def configure_site():
103103
app._logger = get_logger('Comet', loghandlers)
104104
app.http_logger = get_logger('CometHTTP', hloghandlers)
105105

106-
if site.configured:
107-
scan_site()
108-
else:
106+
if not site.configured:
109107
app.logger("Not a Nikola site.")
110108
return
111109

@@ -142,6 +140,22 @@ def configure_site():
142140
<script src="/comet_assets/js/comet.js"></scripts>
143141
"""
144142

143+
# Theme must inherit from bootstrap3, because we have hardcoded HTML for that.
144+
bs3 = ('bootstrap3' in site.THEMES) or ('bootstrap3-jinja' in site.THEMES)
145+
if not bs3:
146+
app.logger.notice("THEME does not inherit from 'bootstrap3' or 'bootstrap3-jinja', using 'bootstrap3' instead.")
147+
site.config['THEME'] = 'bootstrap3'
148+
# Reloading some things
149+
site._THEMES = None
150+
site._get_themes()
151+
site._template_system = None
152+
site._get_template_system()
153+
if 'has_custom_css' in site._GLOBAL_CONTEXT:
154+
del site._GLOBAL_CONTEXT['has_custom_css']
155+
site._get_global_context()
156+
157+
scan_site()
158+
145159
tmpl_dir = pkg_resources.resource_filename(
146160
'comet', os.path.join('data', 'templates', site.template_system.name))
147161
if os.path.isdir(tmpl_dir):

0 commit comments

Comments
 (0)
Please sign in to comment.