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

Set list as an item in MultiDict #2105

Open
tfotis opened this issue May 21, 2024 · 0 comments
Open

Set list as an item in MultiDict #2105

tfotis opened this issue May 21, 2024 · 0 comments

Comments

@tfotis
Copy link

tfotis commented May 21, 2024

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']})
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

No branches or pull requests

1 participant