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

fields.List of fields.Integer doesn't work as expected with as_string #788

Closed
cactus opened this Issue May 2, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@cactus

cactus commented May 2, 2018

Currently this does not seem correct:

>>> o = type('Object', (), {'ids': [1,2,3]})()
>>> field = fields.List(fields.Integer(as_string=True))
>>> field.serialize('ids', o)
[1, 2, 3]

I was expecting ['1', '2', '3']

It does work as expected for single values:

>>> o = type('Object', (), {'id': 1})()
>>> single_field = fields.Integer(as_string=True)
>>> single_field.serialize('id', o)
'1'

@cactus cactus changed the title from fields.List with fields.Integer doesn't work with as_string to fields.List with fields.Integer doesn't work as expected with as_string May 2, 2018

@cactus cactus changed the title from fields.List with fields.Integer doesn't work as expected with as_string to fields.List of fields.Integer doesn't work as expected with as_string May 2, 2018

lafrech added a commit that referenced this issue May 2, 2018

@lafrech

This comment has been minimized.

Member

lafrech commented May 2, 2018

Thanks for reporting this.

I just sent a fix: #789.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment