Support Werkzeug MultiDict in fields.List
See original GitHub issueI’m talking about werkzeug.datastructures.ImmutableMultiDict. This is the type flask.request.values will give you. (actually it’s a CombinedMultiDict but they have the same interface).
You can get a single value out of it with []
or get()
, or a list of values with getlist()
. It would be neat if marshmallow’s fields.List()
knew to check for the getlist()
method, in case it is given a multidict that can return a list in this way.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:4
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Data Structures — Werkzeug Documentation (2.2.x)
Works like a regular MultiDict but preserves the order of the fields. To convert the ordered multi dict into a list you can...
Read more >werkzeug.MultiDict — Flask API - GitHub Pages
MultiDict implements all standard dictionary methods. Internally, it saves all values for a key as a list, but the standard dict access methods...
Read more >Advanced Usage - webargs 8.2.0 documentation
from webargs import fields from webargs.flaskparser import parser ... schema): # relies on the Flask (werkzeug) MultiDict type's implementation of # these ...
Read more >Retrieving data from a combined multidict in python [duplicate]
from flask import Flask, request, jsonify from paho.mqtt import client as mqtt_client from werkzeug.datastructures import MultiDict app ...
Read more >Werkzeug Documentation - Read the Docs
Werkzeug currently has experimental support for Python 3. ... For example MultiDict is a member of the werkzeug module but internally imple-.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@samjetski is correct that @sloria 's code doesn’t work for the issue.
This helped me:
Thanks for the suggestion. I’m going to hold off on adding built-in support for MultiDicts because it is a 3rd-party interface (albeit a very common one among the web frameworks). You can add support relatively easily by overriding a
Schema's
accessor: