⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Fix RenderFilter's handling of deferred values#1258

Open
jasmith-hs wants to merge 2 commits intomasterfrom
fix-render-filter-deferred-values
Open

Fix RenderFilter's handling of deferred values#1258
jasmith-hs wants to merge 2 commits intomasterfrom
fix-render-filter-deferred-values

Conversation

@jasmith-hs
Copy link
Contributor

Currently when using |render filter and encountering a DeferredValue as part of the interpreter.renderFlat, a DeferredToken will be created and the output will be correct, but it will lose the indication that there was a deferred value.

Similar to #920

{% set foo = "Hi {{ search_term|escape }}" %}
{{ foo|render|escape_jinjava }}

Currently results in:

Hi {{ filter:escape.filter(search_term, ____int3rpr3t3r____) }}

Because RenderFilter did not have any indication that the filter chain could not keep going. This is fixes as a DeferredInvocationResollutionException is now thrown. This results in the rendered value getting stored in a temporary value and substituted for the |render filter.

I also replaced some usages of DeferredParsingException with DeferredValueException in this PR because those usages didn't do anything beneficial and removing that logic makes the code ever so slightly less complex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants