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

GuidoTournois opened this issue Jul 21, 2021 · 1 comment


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])
>> ['bar3', 'bar', 'bar2']
>> {'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.

  • 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
Copy link

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.
None yet
None yet

No branches or pull requests

2 participants