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

Unified Diff: cms/converters.py

Issue 6359255103832064: Issue 2178 - [cms] Allow using {% do %} in Jinja2 templates (Closed)
Patch Set: Created March 19, 2015, 9:01 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/converters.py
===================================================================
--- a/cms/converters.py
+++ b/cms/converters.py
@@ -279,17 +279,21 @@ class TemplateConverter(Converter):
exec code in module.__dict__
func = os.path.basename(root)
if not hasattr(module, func):
raise Exception("Expected function %s not found in filter file %s" % (func, filename))
filters[func] = getattr(module, func)
filters[func].module_ref = module # Prevent garbage collection
- self._env = jinja2.Environment(loader=self._SourceLoader(self._params["source"]), autoescape=True)
+ self._env = jinja2.Environment(
+ loader=self._SourceLoader(self._params["source"]),
+ extensions=["jinja2.ext.do",],
+ autoescape=True
+ )
self._env.filters.update(filters)
self._env.globals.update(globals)
def get_html(self, source):
template = self._env.from_string(source)
return template.render(self._params)
def translate(self, default, name, comment=None):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld