From fc376b70dcf20b1aa56e72ea4ed68f453f66fa8d Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Sat, 7 Apr 2018 10:21:46 +0200 Subject: The load_template now gets a string instead of a boolean to select the templating engine --- patternutils/commands/targs.py | 2 +- patternutils/template.py | 4 ++-- 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 -- cgit v1.3.1