[Python-Dev] urllib.urlencode & repeated values
Skip Montanaro
skip@mojam.com (Skip Montanaro)
Wed, 17 Jan 2001 22:20:30 -0600 (CST)
I'm pretty sure this has come up before, but urllib.urlencode doesn't handle
repeated parameters properly. If I call
urllib.urlencode({"performers": ("U2","Lawrence Martin")})
instead of getting
performers=U2&performers=Lawrence+Martin
I get a quoted stringified tuple:
performers=%28%27U2%27%2c+%27Lawrence+Martin%27%29
Obviously, fixing this will change the function's current semantics, but I
think it's worth treating lists and tuples (actually, any sequence) as
repeated values. If the existing semantics are deemed valuable enough, a
third default parameter could be added to switch on the new behavior when
desired.
If others agree I'd be happy to whip up a patch. I think it's a bug.
Skip