diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-10-03 12:41:21 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-10-03 13:08:17 +0300 |
commit | d8b539a9f2a18369400444ada72dff4a83595bab (patch) | |
tree | 56d920df78424dd5ed486dd2bc5a240cfa0a39d0 /jtlib/app.py | |
parent | 7cb2a4b266c1d140ebd3c9198ca5754acda576ae (diff) | |
download | jt-d8b539a9f2a18369400444ada72dff4a83595bab.tar.gz |
Use jinja2 for templates
Diffstat (limited to 'jtlib/app.py')
-rw-r--r-- | jtlib/app.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/jtlib/app.py b/jtlib/app.py index 4b0c54e..6e33646 100644 --- a/jtlib/app.py +++ b/jtlib/app.py @@ -18,6 +18,8 @@ import cliapp import os import time +import jinja2 + import jtlib @@ -106,3 +108,8 @@ class JournalTool(cliapp.Application): if os.path.exists(filename): with open(filename) as f: return f.read() + + def render_template(self, basename, vars): + text = self.read_template(basename) + template = jinja2.Template(text) + return template.render(**vars) |