Author: ezio.melotti Date: Wed Jul 22 23:17:14 2009 New Revision: 74180 Log: Merged revisions 74179 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r74179 | ezio.melotti | 2009-07-23 00:08:49 +0300 (Thu, 23 Jul 2009) | 1 line #6423 has_key -> in ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/library/cgi.rst Modified: python/branches/py3k/Doc/library/cgi.rst ============================================================================== --- python/branches/py3k/Doc/library/cgi.rst (original) +++ python/branches/py3k/Doc/library/cgi.rst Wed Jul 22 23:17:14 2009 @@ -88,12 +88,13 @@ variables set according to the CGI standard). Since it may consume standard input, it should be instantiated only once. -The :class:`FieldStorage` instance can be indexed like a Python dictionary, and -also supports the standard dictionary methods :meth:`__contains__` and -:meth:`keys`. The built-in :func:`len` is also supported. Form fields -containing empty strings are ignored and do not appear in the dictionary; to -keep such values, provide a true value for the optional *keep_blank_values* -keyword parameter when creating the :class:`FieldStorage` instance. +The :class:`FieldStorage` instance can be indexed like a Python dictionary. +It allows membership testing with the :keyword:`in` operator, and also supports +the standard dictionary method :meth:`keys` and the built-in function +:func:`len`. Form fields containing empty strings are ignored and do not appear +in the dictionary; to keep such values, provide a true value for the optional +*keep_blank_values* keyword parameter when creating the :class:`FieldStorage` +instance. For instance, the following code (which assumes that the :mailheader:`Content-Type` header and blank line have already been printed) @@ -101,7 +102,7 @@ string:: form = cgi.FieldStorage() - if not ("name" in form and "addr" in form): + if "name" not in form or "addr" not in form: print("<H1>Error</H1>") print("Please fill in the name and addr fields.") return
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4