-
Notifications
You must be signed in to change notification settings - Fork 240
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
Get error when I set fields as tuples instead of lists #271
Comments
could you please provide the full traceback?!
|
I'm not author, but I could:
Generally, Cerberus modifies input, I think this is very bad: original = [1, 2]
schema = {
'my_field': {'type': 'list', 'schema': {'type': 'string', 'coerce': str}}
}
validator = Validator(schema)
validator.validate({'my_field': original})
print(original == [1, 2]) # False — WAT?
print(original == ['1', '2']) # True — WAAT??!1 |
@theosotr support for normalizing tuples would have to be amended. it's certainly welcome. in your case you could also avoid hitting the normalization code by calling @andreymal this behavior has recently been amended to the docs. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have the following piece of code.
I get the following exception:
TypeError: 'tuple' object does not support item assignment
When I set
my_field
as list works fine. However, I would like cerberus to supporttuple objects
as well.The text was updated successfully, but these errors were encountered: