[Patches] [Patch #103391] Add support for lists in urlencode

noreply@sourceforge.net noreply@sourceforge.net
Sun, 28 Jan 2001 13:19:43 -0800


Patch #103391 has been updated. 

Project: python
Category: library
Status: Accepted
Submitted by: bquinlan
Assigned to : fdrake
Summary: Add support for lists in urlencode

Follow-Ups:

Date: 2001-Jan-28 13:19
By: montanaro

Comment:
accepted with modifications and closed
the major modification was to expand the acceptable input types beyond
dictionaries and lists.  Anything that has an items method should work as a
stand-in for a real dictionary, and anything that is a non-empty sequence
of two-element tuples should workk as a stand-in for lists.

test cases suitably extended & documentation adjusted.

Marked as accepted and reassigned to Fred so he can sign off
on the urlencode documentation.  (Fred, close it out when you're
happy...)


-------------------------------------------------------

Date: 2001-Jan-26 21:30
By: bquinlan

Comment:
Not sure how to post this...

Here is a mod to liburllib.tex, change the section for urlencode at 146:

\begin{funcdesc}{urlencode}{query\optional{, doseq}}
Convert a list of 2-tuples or a dictionary to a ``url-encoded'' string, 
suitable to pass to \function{urlopen()} above as the optional \var{data}

argument.  This is useful to pass form fields to a 
\code{POST} request.  The resulting string is a series of
\code{\var{key}=\var{value}} pairs separated by \character{\&}
characters, where both \var{key} and \var{value} are quoted using
\function{quote_plus()} above.  If the optional parameter \var{doseq} is
present and evaluates to true, individual \code{\var{key}=\var{value}}
pairs
are generated for each element of the sequence.
\end{funcdesc}
-------------------------------------------------------

Date: 2001-Jan-26 12:01
By: montanaro

Comment:
I'll take a closer look at this.  It's actually not a bug in the CGI
scripts.  CGI parameters are supposed to be returned in the order they
appear in the form.  This allows you to, for instance, ask for two lines of
addresses in a mailing label form and name both parameters "address"
without losing the user's input order.  Kind of fragile though, so I don't
recommend it as a standard form programming practice.

Skip

-------------------------------------------------------

Date: 2001-Jan-26 09:56
By: bquinlan

Comment:
Unfortunately, we must sometimes interoperate with scripts that we did not
write. Therefore their (buggy) behavior must be accomodated.

I did update the test suite. I'll provide a diff for the .tex file sometime
today.
-------------------------------------------------------

Date: 2001-Jan-26 07:12
By: fdrake

Comment:
This sounds to me like those CGI scripts are buggy.  Postponed pending
documentation and test suite updates.  Assigned to Skip since he thought
the idea was reasonable & I can't assign to the submittor.
-------------------------------------------------------

Date: 2001-Jan-23 22:34
By: montanaro

Comment:
Seems like a reasonable extension to me.  needs a Doc/lib/liburllib.tex
update though.


-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=103391&group_id=5470