3 ms·
Neat! One problem I can see is that query strings aren't dictionaries, so valid parameters can vanish: >>> furl('http://www.example.com?foo=1&foo=2') f
by xnxn 15y ago
Neat! One problem I can see is that query strings aren't dictionaries, so valid parameters can vanish:
>>> furl('http://www.example.com?foo=1&foo=2')
furl('http://www.example.com?foo=1')
See Werkzeug's MultiDict for one way to handle this correctly.
- grun 15y agoQuery parameters as a dictionary was an ease of use tradeoff over the rarely utilized flexibility of repeated query parameters. https://github.com/gruns/furl/blob/master/furl.py#L142 Werkzeug's MultiDict looks like a good combination for the best of both worlds, ease of use and flexibility. Thanks for the reference.
- rch 15y agoI have to second the MultiDict suggestion -- I was very happy to see Werkzeug had gone that route when I had to throw some Python in front of Solr.
- ubernostrum 15y agoRepeated query parameters aren't "rarely utilized" -- look at how any sort of checkbox or other multi-select works.