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

Allow UrlFor fields to fail somehow #18

Closed
RobinRamael opened this issue May 1, 2015 · 4 comments

Comments

@RobinRamael
Copy link

commented May 1, 2015

I'm trying to render HATEOAS links for a user that may or may not have the attribute avatar_filename. When the user does not have that attribute or it is None, it would be nice to just skip the rendering of the field all together. Is it possible to do this in some way? Or if not, would this be something that I could help implement?

@johnchristopherjones

This comment has been minimized.

Copy link

commented Dec 14, 2015

I believe the suggested behavior should be the correct behavior. I think the problem is that the ma.URLFor("thingies.thingy" id="<thingattribute>"> syntax raises an error if thingattribute isn't set on thingy. By contrast, if an attribute is missing for a fields set with a Marshmallow field type that field is just omitted on serialization.

@hachaboob

This comment has been minimized.

Copy link

commented Jun 3, 2016

I would like to see something configurable for Schemas (probably by using a base Schema class) which you could set whether you wanted the field which caused an AttributeError omitted entirely or set to None/null.

@joshfriend

This comment has been minimized.

Copy link

commented Nov 26, 2016

I've used marshmallow by itself for quite a while now, but just started to try out the flask-marshmallow integration. I got stuck on this problem almost immediately. I'm sure I can figure out a way around it somehow but it's kindof a dealbreaker as is

sloria added a commit that referenced this issue Mar 10, 2019

@sloria sloria closed this in #125 Mar 10, 2019

@sloria

This comment has been minimized.

Copy link
Member

commented Mar 10, 2019

Sorry for the delay on this. This is now fixed in 0.10.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.