diff --git a/operator/poolboy_templating.py b/operator/poolboy_templating.py index a2e3be0..acdfdda 100644 --- a/operator/poolboy_templating.py +++ b/operator/poolboy_templating.py @@ -201,7 +201,7 @@ class TemplateVariable(object): '''Variable may contain template string referencing other variables.''' def __init__(self, value): self.value = value - self.j2template = j2template_get(value) if '{{' in value else None + self.j2template = j2template_get(value) if '{{' in value or '{%' in value else None def get_typed_value(self): if self.j2template: diff --git a/test/unittest-poolboy_templating.py b/test/unittest-poolboy_templating.py index cac88ac..937e8f6 100755 --- a/test/unittest-poolboy_templating.py +++ b/test/unittest-poolboy_templating.py @@ -623,5 +623,17 @@ def test_45(self): True ) + def test_46(self): + template = "{% if show_a %}a{% endif %}" + template_variables = { + "show_a": True, + } + self.assertEqual( + recursive_process_template_strings( + template, template_variables=template_variables + ), + "a", + ) + if __name__ == '__main__': unittest.main()