You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using DebugUndefined to make a partial template, the filters are not kept if a variable is not passed to the template. Similar-ish to #1871 and other DebugUndefined issues.
Replication
>>>importjinja2>>>jinja2.__version__'3.1.2'>>>env=jinja2.Environment(undefined=jinja2.DebugUndefined)
>>>template=env.from_string("{{ var|safe }}")
>>>template.render()
'{{ var }}'>>>template.render(var="hello")
'hello'>>>
Expectation
I'm not sure 100% sure if this is the best way to do a partial template rendering, but was all I found on Stackoverflow and other places.
I'm pretty sure that your usecase is not what DebugUndefined is meant for - it's simply meant to be a way to quickly see the variable that's missing. Not to get something that's again to be used as a functional jinja template....
Description
When using DebugUndefined to make a partial template, the filters are not kept if a variable is not passed to the template. Similar-ish to #1871 and other DebugUndefined issues.
Replication
Expectation
I'm not sure 100% sure if this is the best way to do a partial template rendering, but was all I found on Stackoverflow and other places.
https://stackoverflow.com/questions/12994028/multiple-renders-of-jinja2-templates (old)
Environment:
Workaround
My current workaround is just a string replace like
The text was updated successfully, but these errors were encountered: