chalice
chalice copied to clipboard
Set list as an item in MultiDict
It would be nice if there can be a way to set a list as an item in a MultiDict object.
This is currently only possible if you re-create the object.
Examples
from chalice.app import MultiDict
m = MultiDict(None)
m["a"] = ["a1", "a2"]
print(m)
// MultiDict({'a': [['a1', 'a2']]}) # list is inserted in a list
from chalice.app import MultiDict
m = MultiDict({"a": ["a1", "a2"]})
print(m)
// MultiDict({'a': ['a1', 'a2']}) # list is OK, as it was provided during object creation
So maybe the correct functionality for __setitem__
would be the following:
from chalice.app import MultiDict
m = MultiDict(None)
m["a"] = ["a1", "a2"]
print(m)
// MultiDict({'a': ['a1', 'a2']})