diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2015-02-06 08:21:37 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2015-02-06 08:21:37 (GMT) |
commit | bf5e9604cc5a5ae61181b093193286f06a502ad6 (patch) | |
tree | c20966ea695e430b9dddae88196def7aca84f309 /Doc/library/cgi.rst | |
parent | 088ca8b9470e51b932b73d6b39d970b0292f2ba3 (diff) | |
download | cpython-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.rst | 7 |
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 ---------------------- |