Skip to content

add context in evaluate transform arguments#30

Open
arcosa wants to merge 1 commit intomozilla:masterfrom
arcosa:fix-evaluate-transform-args-with-context
Open

add context in evaluate transform arguments#30
arcosa wants to merge 1 commit intomozilla:masterfrom
arcosa:fix-evaluate-transform-args-with-context

Conversation

@arcosa
Copy link
Copy Markdown

@arcosa arcosa commented Jul 12, 2023

We have expressions of the following type:

exp1|transform(exp2)

If exp2 depends on the context, it is currently executed as transform(exp1, None).

This is because if exp2 depends on the context, it is unable to evaluate the correct value. By adding the context in the evaluation of the transformation arguments, it allows us to evaluate expressions of that type.

For expressions where exp2 does not depend on the context, we don't have that problem.

An example would be an expression of the type:

0|rnd(max)

with max in the context having a value of 10.
It should apply rnd(0,10) but instead it applies rnd(0,None).

On the other hand,

0|rnd(10)

does it correctly

@fgalan
Copy link
Copy Markdown

fgalan commented Mar 11, 2024

While this PR gets hopefully merged in pyjexl (and a version included the fix gets released) we have build a wrapper named tcjexl (https://github.com/telefonicasc/tcjexl) which 0.2.0 release (https://github.com/telefonicasc/tcjexl/tree/0.2.0) includes a modify copy of pyjexl with the patch in this PR applied.

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