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

Add default to map filter if attribute is not defined #557

Closed
Yannik opened this issue Mar 1, 2016 · 7 comments · Fixed by #1018
Closed

Add default to map filter if attribute is not defined #557

Yannik opened this issue Mar 1, 2016 · 7 comments · Fixed by #1018

Comments

@Yannik
Copy link

Yannik commented Mar 1, 2016

It would be great if the map filter would return an optional default value if the attribute is not defined.

Example:

list_of_dicts|map(attribute='version', default='5.6')
@esaezgil
Copy link

Hi @DanyC97 and @Yannik thanks for raising this! :) it's been so long that the MR has conflicts. I will try to solve them asap

@pallets pallets deleted a comment from esaezgil Oct 11, 2017
@pallets pallets deleted a comment from DanyC97 Oct 11, 2017
@pallets pallets deleted a comment from Yannik Oct 11, 2017
@pallets pallets deleted a comment from hsychla Dec 8, 2017
@wedi
Copy link

wedi commented Mar 22, 2018

Are there any news regarding this feature? Why was the pulled request closed? Should someone else take over or is this just undesired?

@esaezgil
Copy link

I closed the pull request myself as I do not have any further interest pursuing it. Please feel free to contribute with another PR.

@akamac
Copy link

akamac commented Jul 5, 2018

I would love to see this implemented

@shashanksingh28
Copy link

Working on this in Pycon 2019 Sprints

@kbiggers
Copy link
Contributor

#1018

@flexferrum
Copy link
Contributor

flexferrum commented Jun 14, 2019

Is it a good idea to add 'default' param to the 'attr' filter as well? As a shorthand for someVal | attr('someAttr') | default(10)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants