ListField should enforce that input is a list#3513
ListField should enforce that input is a list#3513lovelydinosaur merged 6 commits intoencode:masterfrom
Conversation
|
What about sets or tuples? |
|
I could include tuples and sets |
|
Thanks for the path.
|
|
You're right, I think excluding dictionaries from the ListField in addition to what was already in that line would do the trick. |
|
Agree - excluding dicts sounds like a good way around to do this. |
|
Note: by dict we should read any mapping type. |
IDK - any chance that could be a bit fuzzy in cases we've not thought of? |
|
Well, collections.Mapping should be a good base class to test against (as opposed to just dict). |
|
Probably want tests that prove this works as intended. |
|
Yup, having tests would be great so we merge it. |
|
Tests added. |
|
Looks good, thanks! |
…orce_list ListField does not enforce that input is a list
Purpose
A dictionary is allowed as input in a ListField. If a dictionary is received as input, the keys of the object are retained, and the values are ignored. I assume the ListField should enforce that the input is an array, especially because the error message in
to_internal_valueincludes "not a list" if something is wrong with the data.Changes
Enforces that data cannot be a collections.Mapping.