summaryrefslogtreecommitdiffstats
path: root/Doc/library/cgi.rst
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2015-02-06 08:21:37 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2015-02-06 08:21:37 (GMT)
commitbf5e9604cc5a5ae61181b093193286f06a502ad6 (patch)
treec20966ea695e430b9dddae88196def7aca84f309 /Doc/library/cgi.rst
parent088ca8b9470e51b932b73d6b39d970b0292f2ba3 (diff)
downloadcpython-bf5e9604cc5a5ae61181b093193286f06a502ad6.zip
cpython-bf5e9604cc5a5ae61181b093193286f06a502ad6.tar.gz
cpython-bf5e9604cc5a5ae61181b093193286f06a502ad6.tar.bz2
Issue #20289: cgi.FieldStorage() now supports the context management protocol.
Diffstat (limited to 'Doc/library/cgi.rst')
-rw-r--r--Doc/library/cgi.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/library/cgi.rst b/Doc/library/cgi.rst
index fa13145..0a9e884 100644
--- a/Doc/library/cgi.rst
+++ b/Doc/library/cgi.rst
@@ -157,6 +157,9 @@ return bytes)::
if not line: break
linecount = linecount + 1
+:class:`FieldStorage` objects also support being used in a :keyword:`with`
+statement, which will automatically close them when done.
+
If an error is encountered when obtaining the contents of an uploaded file
(for example, when the user interrupts the form submission by clicking on
a Back or Cancel button) the :attr:`~FieldStorage.done` attribute of the
@@ -182,6 +185,10 @@ A form submitted via POST that also has a query string will contain both
The :attr:`~FieldStorage.file` attribute is automatically closed upon the
garbage collection of the creating :class:`FieldStorage` instance.
+.. versionchanged:: 3.5
+ Added support for the context management protocol to the
+ :class:`FieldStorage` class.
+
Higher Level Interface
----------------------