`selectattr` and `rejectattr` require the third argument to be a collection
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Reproduce the issue with Jinjava using the provided template and compare its rejectattr/in behavior with Jinja2. Trace the argument handling for the in test and verify that the same string input is accepted as iterable, with the example rendering the expected filtered collection.
Written by the indexing model from the issue text.
Description
The following works in Jinja2:
>>> import jinja2
>>> env = jinja2.Environment()
>>> template = env.from_string("{{ [('action', 'down_single'), ('event_type', 'down_single')] | rejectattr(0, 'in', 'name,event_type') | list }}")
>>> template.render()
"[('action', 'down_single')]"
But with Jinjava, I get com.hubspot.jinjava.interpret.FatalTemplateErrorsException: Invalid argument in 'in': 1st argument with value 'name,event_type' must be iterable
I couldn't find the source in Jinja, but I presume somewhere it implicitly turns non-iterables into a list.
- Dominant language
- Java
- Stars
- 785
- Forks
- 184
- Avg merge
- 6d 22h
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from HubSpot/jinjava
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
Jinjava 3.0 Open
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
1.0.0-alpha2 Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/dpdp-accelerator#272 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
apache/rocketmq-dashboard#4860 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·