Skip to content
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

fix: set default argument of jinja-filters.map() when looking up attributes #1989

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

parthea
Copy link
Contributor

@parthea parthea commented Mar 21, 2024

When jinja-filters.map is used to look up an attribute, the default argument should be set in case an object in the list does not have the given attribute.

@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Mar 21, 2024
@parthea parthea marked this pull request as ready for review March 21, 2024 12:20
@parthea parthea requested a review from a team as a code owner March 21, 2024 12:20
@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 21, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 21, 2024
Copy link
Contributor

@vchudnov-g vchudnov-g left a comment

Choose a reason for hiding this comment

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

Thanks for doing this.

It might be good to add to the PR description why we're doing this. Though I haven't found a statement to this effect in the official Jinja documentation, this issue suggests that if the key isn't set and we don't set a default, then map returns a LookupError.

@parthea parthea merged commit 3e74a0a into main Apr 12, 2024
67 checks passed
@parthea parthea deleted the add-default-to-map branch April 12, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants