]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Be more consistent, both internally and with recommended practice (within
authorFred Drake <fdrake@acm.org>
Fri, 26 Apr 2002 20:45:38 +0000 (20:45 +0000)
committerFred Drake <fdrake@acm.org>
Fri, 26 Apr 2002 20:45:38 +0000 (20:45 +0000)
the limits of Python 2.1).
This closes SF bug #547953.

Doc/lib/libcgi.tex

index 8ab562d8b21f00952756ea7a17e3e347acb8c853..6fd8fdd7128c4b1024e936dee56006471910c0a3 100644 (file)
@@ -111,16 +111,17 @@ name, the object retrieved by \samp{form[\var{key}]} is not a
 \class{FieldStorage} or \class{MiniFieldStorage}
 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:
+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 type(value) is type([]):
+if isinstance(value, ListType):
     # Multiple username fields specified
     usernames = ",".join(value)
 else: