HTTP error on receiving a form

brueckd at tbye.com brueckd at tbye.com
Mon Apr 22 12:30:38 EDT 2002


On Mon, 22 Apr 2002, Steve Holden wrote:

> > 2 - is there a quick way to encode data from a dictionary in a specific
> order.
> >
> >
> Not using urllib.urlencode().

(sorry to respond to Steve's post, but I missed the start of this thread)

Not from a dictionary, but urlencode can keep the order from a sequence:

>>> import urllib
>>> help(urllib.urlencode)
Help on function urlencode in module urllib:

urlencode(query, doseq=0)
[snip]
    If the query arg is a sequence of two-element tuples, the order of the
    parameters in the output will match the order of parameters in the
    input.

But like Steve said, the chances that it's an ordering problem are really,
really low (IOW, if it *is* an ordering problem then the server/CGI is
broken :)  ).

-Dave






More information about the Python-list mailing list