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

foreach would remove 1 item when validating generators #89

Open
tinman6 opened this issue Aug 11, 2015 · 0 comments
Open

foreach would remove 1 item when validating generators #89

tinman6 opened this issue Aug 11, 2015 · 0 comments

Comments

@tinman6
Copy link

tinman6 commented Aug 11, 2015

When validating generators with foreach, _convert_to_list would remove 1 item.

This is the culprit:

for n in value:
    break
return value

Our workaround is to override _convert_to_list with the following:

def _convert_to_list(self, value):
    if isinstance(value, types.GeneratorType):
        return list(value)
    else:
        return super(ListOf, self)._convert_to_list(value)
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

No branches or pull requests

1 participant