summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Fink2018-04-07 10:21:46 +0200
committerDennis Fink2018-04-07 10:21:46 +0200
commitfc376b70dcf20b1aa56e72ea4ed68f453f66fa8d (patch)
tree4f5ad4db978e42d6d8c46175e95b4eaab4f2e65d
parent62000d6d02fc3076a6967c207fc0b7836ff6923f (diff)
downloadpatternutils-fc376b70dcf20b1aa56e72ea4ed68f453f66fa8d.tar.gz
patternutils-fc376b70dcf20b1aa56e72ea4ed68f453f66fa8d.zip
The load_template now gets a string instead of a boolean to select the
templating engine
Diffstat (limited to '')
-rw-r--r--patternutils/commands/targs.py2
-rw-r--r--patternutils/template.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/patternutils/commands/targs.py b/patternutils/commands/targs.py
index 14ecce7..59a8ab3 100644
--- a/patternutils/commands/targs.py
+++ b/patternutils/commands/targs.py
@@ -66,7 +66,7 @@ def targs(
use_jinja = True if template_engine == 'jinja2' else False
try:
- render = template.get_render_function(command, use_jinja=use_jinja)
+ render = template.get_render_function(command, engine=template_engine)
except RuntimeError:
click.secho('jinja2 not installed!', fg='red', err=True)
raise SystemExit
diff --git a/patternutils/template.py b/patternutils/template.py
index de1b94c..f45d856 100644
--- a/patternutils/template.py
+++ b/patternutils/template.py
@@ -33,8 +33,8 @@ else:
jinja_env.filters['quote'] = quote
-def get_render_function(template: str, *, use_jinja: bool=False) -> Callable[..., str]:
- if use_jinja:
+def get_render_function(template: str, *, engine: str='python') -> Callable[..., str]:
+ if engine == 'jinja2':
if jinja_feature:
env_template = jinja_env.from_string(template)
render_function = env_template.render