Add tojson filter to jinja environment used by the template module.

pull/956/head
Timothy Appnel 12 years ago
parent 9f7ad62376
commit d306c8debc

@ -211,6 +211,7 @@ def template_from_file(basedir, path, vars):
''' run a file through the templating engine '''
environment = jinja2.Environment(loader=jinja2.FileSystemLoader(basedir), trim_blocks=False)
environment.filters['tojson'] = json.dumps
data = codecs.open(path_dwim(basedir, path), encoding="utf8").read()
t = environment.from_string(data)
vars = vars.copy()

Loading…
Cancel
Save