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

Not parsing load_from #145

Closed
Bangertm opened this issue Nov 22, 2016 · 11 comments

Comments

@Bangertm
Copy link

commented Nov 22, 2016

In 1.5.0 i'm having a problem parsing a field that looks like:

example_field = fields.Nested('ExampleFieldSchema', required=False, many=True, load_from='exampleField', dump_to='exampleField', missing=[])

Worked as expected in 1.4.0 but getting [] in 1.5.0.

I think this line may be problematic. Seems that the intent is to compare parsed_value to the missing value for that field, but as far as I can tell it's comparing to the imported missing function from marshmallow.utils.

@sloria

This comment has been minimized.

Copy link
Member

commented Nov 22, 2016

That line was meant to fix #118. In your example, example_field will be parsed before exampleField. Is example_field present in your request input?

@Bangertm

This comment has been minimized.

Copy link
Author

commented Nov 22, 2016

No in the input the field name is camel case exampleField for the load_from value.

Mike

On Nov 22, 2016, at 10:42 AM, Steven Loria notifications@github.com wrote:

That line was meant to fix #118. In you example, example_field will be parsed before exampleField. Is example_field present in your request input?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@sloria

This comment has been minimized.

Copy link
Member

commented Nov 22, 2016

@Bangertm would you mind posting code to replicate the problem?

@Bangertm

This comment has been minimized.

Copy link
Author

commented Nov 22, 2016

Here's an example that demonstrates the problem:

webargs_problem.txt

output with 1.4.0 (expected)
{'example_field': [{'key': u'mykey', 'value': u'myvalue'}]}
UnmarshalResult(data={'example_field': [{'key': u'mykey', 'value': u'myvalue'}]}, errors={})

output with 1.5.0 (unexpected)
{'example_field': []}
UnmarshalResult(data={'example_field': [{'key': u'mykey', 'value': u'myvalue'}]}, errors={})

@sloria

This comment has been minimized.

Copy link
Member

commented Nov 23, 2016

Thank you @Bangertm . I will try to get this bug fixed over the next few days.

@sloria

This comment has been minimized.

Copy link
Member

commented Nov 23, 2016

It appears that this is related to #120 . I believe this is fixed by f0974de

@sloria sloria closed this in f0974de Nov 23, 2016

@sloria

This comment has been minimized.

Copy link
Member

commented Nov 23, 2016

This is now fixed on the dev branch. @Bangertm can you confirm this?

@sloria sloria reopened this Nov 23, 2016

@Bangertm

This comment has been minimized.

Copy link
Author

commented Nov 23, 2016

@sloria working great! Tested with both my example program and our application - works with both.

Really appreciate the quick follow up on this.

@sloria

This comment has been minimized.

Copy link
Member

commented Nov 23, 2016

Great! Thanks for checking that and thanks for reporting the issue.

@sloria sloria closed this Nov 23, 2016

@Bangertm

This comment has been minimized.

Copy link
Author

commented Nov 23, 2016

No problem. Webargs and marshmallow have been really helpful in a couple of our projects. Saved us a ton of time.

@sloria

This comment has been minimized.

Copy link
Member

commented Nov 23, 2016

Good to hear!

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