On 08 Sep 2014, at 16:04, pyramidX <[email protected]> wrote:
> In Python 3 what is the best way to turn a string that's a URL querystring
> (gotten from anywhere, not necessarily current request) into an IMultiDict?
> Is it urllib.parse or is there a more Pyramid specific way of doing this? I
> tried to look in the Pyramid code on github but couldn't find how IMultiDict
> is created (searched for IMultiDict but couldn't find the class that
> implements that interface).
There is nothing Pyramid-specific about that: Python's standard library has a
function to decode the query string, and MultiDict comes from webob. This
should work in Python 3 (untested since I use Python 2 only):
>>> from webob.multidict import MultiDict
>>> from urllib.parse import parse_qsl
>>> d = MultiDict(parse_qsl('foo=bar&foo=buz'))
>>> d.getall('foo')
['bar', 'buz']
Wichert.
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.