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

to_dict method on CombinedMultiDict doesn't give combined result for overlapping keys #2189

Closed
GuidoTournois opened this issue Jul 21, 2021 · 1 comment
Milestone

Comments

@GuidoTournois
Copy link

Whenever I call to_dict(flat=False) on a CombinedMultiDict, obtained from combining two MultiDicts with overlapping keys, only the values of the last MultiDict are returned.

# altered from documentation to make keys overlapping.
from werkzeug.datastructures import CombinedMultiDict, MultiDict
post = MultiDict([('foo', 'bar'),('foo', 'bar2')])
get = MultiDict([('foo', 'bar3')])
combined = CombinedMultiDict([get, post])
combined.getlist('foo')
>> ['bar3', 'bar', 'bar2']
combined.to_dict(flat=False)
>> {'foo': ['bar3']}

From a class that intends to combine two MultiDicts, I expect the result from one of its methods to be a combined result.
Environment:

  • Python version: 3.6.8
  • Werkzeug version: 1.0.1
@GuidoTournois GuidoTournois changed the title to_dict method on CombinedMultiDict doesn't give expected result. to_dict method on CombinedMultiDict doesn't give combined result for overlapping keys Jul 21, 2021
@GuidoTournois
Copy link
Author

GuidoTournois commented Jul 26, 2021 via email

@davidism davidism modified the milestones: 2.1.0, 2.0.2 Aug 5, 2021
@davidism davidism closed this as completed Aug 5, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants