from jinja2 import Template, StrictUndefined print Template("Hello {{ ax }}", undefined=StrictUndefined).render(a={})
This will throw an exception:
File "<template>", line 1, in top-level template code jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'x'
If you set the value for ax, then it will work as intended:
print Template("Hello {{ ax }}", undefined=StrictUndefined).render(a={'x':42})
will print:
Hello 42
source share