Mailing List Archive

python/dist/src/Doc/lib libcgi.tex,1.28.6.1,1.28.6.2
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv11080/lib

Modified Files:
Tag: release21-maint
libcgi.tex
Log Message:
Be more consistent, both internally and with recommended practice (within
the limits of Python 2.1).
This closes SF bug #547953.


Index: libcgi.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcgi.tex,v
retrieving revision 1.28.6.1
retrieving revision 1.28.6.2
diff -C2 -d -r1.28.6.1 -r1.28.6.2
*** libcgi.tex 29 Jun 2001 15:00:34 -0000 1.28.6.1
--- libcgi.tex 26 Apr 2002 20:45:38 -0000 1.28.6.2
***************
*** 112,125 ****
instance but a list of such instances. Similarly, in this situation,
\samp{form.getvalue(\var{key})} would return a list of strings.
! If you expect this possibility
! (i.e., when your HTML form contains multiple fields with the same
! name), use the \function{type()} function to determine whether you
! have a single instance or a list of instances. For example, here's
! code that concatenates any number of username fields, separated by
! commas:

\begin{verbatim}
value = form.getvalue("username", "")
! if type(value) is type([]):
# Multiple username fields specified
usernames = ",".join(value)
--- 112,126 ----
instance but a list of such instances. Similarly, in this situation,
\samp{form.getvalue(\var{key})} would return a list of strings.
! If you expect this possibility (i.e., when your HTML form contains
! multiple fields with the same name), use the \function{isinstance()}
! built-in function to determine whether you have a single instance or a
! list of instances. For example, here's code that concatenates any
! number of username fields, separated by commas:

\begin{verbatim}
+ from types import ListType
+
value = form.getvalue("username", "")
! if isinstance(value, ListType):
# Multiple username fields specified
usernames = ",".join(value)