Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/utils.py

Issue 6439145228468224: Added custom template loader to CMS in order to enable {% include %} and {% import %} in jinja temp… (Closed)
Patch Set: Only allow inlcudes with escaped brackets in markdown Created Dec. 12, 2013, 1:48 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sitescripts/cms/converters.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/utils.py
===================================================================
--- a/sitescripts/utils.py
+++ b/sitescripts/utils.py
@@ -142,13 +142,15 @@
env.filters.update(filters)
return env
-def get_custom_template_environment(additional_filters):
+def get_custom_template_environment(additional_filters, loader=None):
"""
Returns a custom Jinja2 template environment with additional filters.
"""
from sitescripts.templateFilters import filters
import jinja2
- env = jinja2.Environment(loader=jinja2.FileSystemLoader(siteScriptsPath), autoescape=True)
+ if not loader:
+ loader = jinja2.FileSystemLoader(siteScriptsPath)
+ env = jinja2.Environment(loader=loader, autoescape=True)
env.filters.update(filters)
env.filters.update(additional_filters)
return env
« no previous file with comments | « sitescripts/cms/converters.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld