Skip to content

Comments

Updates for Jinja2 >= 3.1.x#76

Open
raffienficiaud wants to merge 1 commit intochristopher-ramirez:masterfrom
raffienficiaud:master
Open

Updates for Jinja2 >= 3.1.x#76
raffienficiaud wants to merge 1 commit intochristopher-ramirez:masterfrom
raffienficiaud:master

Conversation

@raffienficiaud
Copy link

  • importing Markup from MarkupSafe
  • replacing evalcontextfilter by pass_eval_context
  • making the dependency explicit

* importing Markup from MarkupSafe
* replacing evalcontextfilter by pass_eval_context
* making the dependency explicit
@raffienficiaud
Copy link
Author

Note: this may conflict with #74 but I can make my code work together with the trick in #73

self._compile_tags_expressions()

@jinja2.evalcontextfilter
@jinja2.pass_eval_context
Copy link
Contributor

@j123b567 j123b567 Jun 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is stated in the jinja2 documentation that one should use pass_eval_context instead of evalcontextfilter but it is not true for this code. In that case, document will be full of <jinja2.nodes.EvalContext object at 0x.....> because the decorator injects first argument, which is not expected here.

Better would be to add context argument

@jinja2.pass_eval_context
def finalize_value(self, ctx, value, *args):

but I don't know any usage for it. I also don't understand, why it even works with previous Jinja versions.

So, the best solution seems to be to completeldy remove the decorator.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment addressed in raffienficiaud#1 : works without issue without those decorators.

@raffienficiaud
Copy link
Author

This work is being superseded by this PR: raffienficiaud#1

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