Merge pull request #956 from tima/jinja-json-filter
Add tojson filter to jinja environment used by the template module.
This commit is contained in:
commit
7ec0afbebc
1 changed files with 1 additions and 0 deletions
|
@ -241,6 +241,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…
Reference in a new issue