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

Take default value when value is None #1766

Closed
dormeiri opened this issue Mar 18, 2021 · 2 comments
Closed

Take default value when value is None #1766

dormeiri opened this issue Mar 18, 2021 · 2 comments

Comments

@dormeiri
Copy link

I would like to specify fields that will use the default value if their value is None (even if they are not missing), something similar to the following field declaration will match perfectly to my case:

fields.Pluck(MySchema, 'x', default={'x': 0}, take_default_on=[None])

Is there any way doing this without @post_dump or overriding get_attribute method?

@lafrech
Copy link
Member

lafrech commented Mar 18, 2021

Discussed in #1381.

@sloria
Copy link
Member

sloria commented Mar 18, 2021

Yep, let's continue discussion on that PR or on its linked issue.

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 a pull request may close this issue.

3 participants