[docs] Update doc for the cgi module in version 3.2

Pierre Quentel pierre.quentel at gmail.com
Mon Feb 21 10:30:30 CET 2011


Hi,

In the final version of Python 3.2 the documentation of the cgi module has
not been changed, so it's not in line with what the module does

It was my first contribution to the documentation so maybe I missed
something ?

Best regards,
Pierre

2011/1/23 Pierre Quentel <pierre.quentel at gmail.com>

> Hi,
>
> I wrote a patch for the cgi module in version 3.2rc1. Small changes should
> be done to the documentation of this module to reflect the changes in the
> module API :
>
> - in section "20.2.2. Using the cgi module"
>
> original text :
> "If a field represents an uploaded file, accessing the value via the value
> attribute or the getvalue() method reads the entire file in memory as a
> string. This may not be what you want. You can test for an uploaded file by
> testing either the filename attribute or the file attribute. You can then
> read the data at leisure from the file attribute:"
>
> proposed new text (for files, value is bytes, not string, and the read()
> method on file also returns bytes) :
> "If a field represents an uploaded file, accessing the value via the value
> attribute or the getvalue() method reads the entire file in memory as bytes.
> This may not be what you want. You can test for an uploaded file by testing
> either the filename attribute or the file attribute. You can then read the
> data at leisure from the file attribute (the read() and readline() methods
> will return bytes) :"
>
> - version 2.1 introduced a parameter "encoding" for the FieldStorage
> constructor, used to decode the bytes received on the HTTP connection for
> fields other than files. This encoding must the one defined in the HTML
> document holding the form submitted to the CGI script ; it is usually
> defined by a meta tag :
> <meta http-equiv="Content-type" content="text/html;charset=latin-1">
> or by the Content-Type header for this document
>
> I'm not sure where this should be mentioned in the documentation. Maybe in
> "20.2.9. Common problems and solutions" for the moment. But there are plans
> to introduce another interface to change the encoding of sys.stdout in the
> CGI script itself, so another option would be to open a specific section
> about encodings
>
> Hope it's clear enough
> Pierre
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20110221/3e3e7ca6/attachment-0001.html>


More information about the docs mailing list