Skip to content

selectattr and rejectattr require the third argument to be a collection #1227

Description

@ccutrer

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions