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

Unified Diff: sitescripts/utils.py

Issue 11481051: Update stats processing (Closed)
Patch Set: Fixed two presentation issues Created Aug. 24, 2013, 1:11 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
« sitescripts/stats/bin/pagegenerator.py ('K') | « sitescripts/templateFilters.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
@@ -136,8 +136,19 @@ def get_unescaped_template_environment()
Returns a Jinja2 template environment without autoescaping. Don't use this to
generate HTML files!
"""
from sitescripts.templateFilters import filters
import jinja2
env = jinja2.Environment(loader=jinja2.FileSystemLoader(siteScriptsPath))
env.filters.update(filters)
return env
+
+def get_custom_template_environment(additional_filters):
+ """
+ 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, extensions=['jinja2.ext.autoescape'])
Sebastian Noack 2013/08/26 16:05:22 You don't need to add the autoescape extesnion to
+ env.filters.update(filters)
+ env.filters.update(additional_filters)
+ return env
« sitescripts/stats/bin/pagegenerator.py ('K') | « sitescripts/templateFilters.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld