New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent random filter from being inlined #478

Closed
wants to merge 1 commit into
from

Conversation

3 participants
@snoack
Contributor

snoack commented Aug 10, 2015

Currently, due to #476 environment filters like random aren't optimized/inlined. While this is a bug for any other filter, the random filter should never be inlined, but always be evaluated at runtime. Otherwise, once the template is compiled, the random filter would always give the same results. So this pull request turns random into a contextfilter to prevent it from being inlined.

@k4nar

This comment has been minimized.

Show comment
Hide comment
@k4nar

k4nar Apr 20, 2017

I've encountered this bug with Jinja 2.9.6 and this patch fixes it.

If this isn't merged, a workaround is to simply override env.filters['random'] with the do_random function from this patch.

k4nar commented Apr 20, 2017

I've encountered this bug with Jinja 2.9.6 and this patch fixes it.

If this isn't merged, a workaround is to simply override env.filters['random'] with the do_random function from this patch.

@davidism

This comment has been minimized.

Show comment
Hide comment
@davidism

davidism Jul 5, 2017

Member

New test doesn't fail when run on master.

Member

davidism commented Jul 5, 2017

New test doesn't fail when run on master.

@davidism

This comment has been minimized.

Show comment
Hide comment
@davidism

davidism Jul 5, 2017

Member

Continued in #734.

Member

davidism commented Jul 5, 2017

Continued in #734.

@davidism davidism closed this Jul 5, 2017

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