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

Fix #459 - Check inner type of the scalar list #464

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ziima
Copy link
Contributor

@ziima ziima commented Jul 9, 2020

A complex fix for #459. I've changed the first argument of ScalarListType to a type of its values, since in most cases it's the same as coerce_func. All values are checked if they match the type on save. Backwards compatibility is maintained.

"""

impl = sa.UnicodeText()

def __init__(self, coerce_func=six.text_type, separator=u','):
def __init__(self, inner_type=six.text_type, separator=u',',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keeping the parameter order as it was and adding the new parameter as the last parameter? That way we wouldn't need to throw any warnings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about that. I believe, having inner_type defined is the only way I can ensure validation of the values before they're written to database. So I made inner_type primary and coerce_func optional. It would be weird to have an optional parameter first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kvesteri Any decision?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kvesteri I'd like to move this forward. Can I keep the change, or should I add the inner_type as the last parameter?

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 this pull request may close these issues.

None yet

2 participants