You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to propose to either check explicitly for dict-like functionality (setitem, getitem), or to at least make the behavior consistent with colander.String (“if not cstruct” instead of “if cstruct is null” in colander/init.py:456).
The text was updated successfully, but these errors were encountered:
All of those types(lists, strings, sets, frozensets) all implement getitem/setitem, so we can't explicitly check for those. So should we just allow a 'dict' to pass through?
In colander/init.py:405-412 (class Mapping(SchemaType)) there's this validation procedure:
The problem is that dict.init will convert to dictionary almost anything:
Which means that all of these validate correctly:
This is inconsistent with, for example, behavior of colander.String.
Zero-value list will result in colander.null:
In colander/init.py:793-759 (class String(SchemaType))
And any([bool( [] ), bool( {} ), bool( "" ), bool( set() ), bool( frozenset() )]) => False
I'd like to propose to either check explicitly for dict-like functionality (setitem, getitem), or to at least make the behavior consistent with colander.String (“if not cstruct” instead of “if cstruct is null” in colander/init.py:456).
The text was updated successfully, but these errors were encountered: