@@ -97,7 +97,7 @@ standard input, it should be instantiated only once.
9797
9898The :class: `FieldStorage ` instance can be indexed like a Python dictionary.
9999It allows membership testing with the :keyword: `in ` operator, and also supports
100- the standard dictionary method :meth: `keys ` and the built-in function
100+ the standard dictionary method :meth: `~dict. keys ` and the built-in function
101101:func: `len `. Form fields containing empty strings are ignored and do not appear
102102in the dictionary; to keep such values, provide a true value for the optional
103103*keep_blank_values * keyword parameter when creating the :class: `FieldStorage `
@@ -119,30 +119,32 @@ string::
119119
120120Here the fields, accessed through ``form[key] ``, are themselves instances of
121121:class: `FieldStorage ` (or :class: `MiniFieldStorage `, depending on the form
122- encoding). The :attr: `value ` attribute of the instance yields the string value
123- of the field. The :meth: `getvalue ` method returns this string value directly;
124- it also accepts an optional second argument as a default to return if the
125- requested key is not present.
122+ encoding). The :attr: `~FieldStorage. value ` attribute of the instance yields
123+ the string value of the field. The :meth: `~FieldStorage. getvalue ` method
124+ returns this string value directly; it also accepts an optional second argument
125+ as a default to return if the requested key is not present.
126126
127127If the submitted form data contains more than one field with the same name, the
128128object retrieved by ``form[key] `` is not a :class: `FieldStorage ` or
129129:class: `MiniFieldStorage ` instance but a list of such instances. Similarly, in
130130this situation, ``form.getvalue(key) `` would return a list of strings. If you
131131expect this possibility (when your HTML form contains multiple fields with the
132- same name), use the :func: ` getlist ` function , which always returns a list of
133- values (so that you do not need to special-case the single item case). For
134- example, this code concatenates any number of username fields, separated by
135- commas::
132+ same name), use the :meth: ` ~FieldStorage. getlist ` method , which always returns
133+ a list of values (so that you do not need to special-case the single item
134+ case). For example, this code concatenates any number of username fields,
135+ separated by commas::
136136
137137 value = form.getlist("username")
138138 usernames = ",".join(value)
139139
140140If a field represents an uploaded file, accessing the value via the
141- :attr: `value ` attribute or the :func: `getvalue ` method reads the entire file in
142- memory as bytes. This may not be what you want. You can test for an uploaded
143- file by testing either the :attr: `filename ` attribute or the :attr: `!file `
141+ :attr: `~FieldStorage.value ` attribute or the :meth: `~FieldStorage.getvalue `
142+ method reads the entire file in memory as bytes. This may not be what you
143+ want. You can test for an uploaded file by testing either the
144+ :attr: `~FieldStorage.filename ` attribute or the :attr: `~FieldStorage.file `
144145attribute. You can then read the data at leisure from the :attr: `!file `
145- attribute (the :func: `read ` and :func: `readline ` methods will return bytes)::
146+ attribute (the :func: `~io.RawIOBase.read ` and :func: `~io.IOBase.readline `
147+ methods will return bytes)::
146148
147149 fileitem = form["userfile"]
148150 if fileitem.file:
@@ -155,8 +157,8 @@ attribute (the :func:`read` and :func:`readline` methods will return bytes)::
155157
156158If an error is encountered when obtaining the contents of an uploaded file
157159(for example, when the user interrupts the form submission by clicking on
158- a Back or Cancel button) the :attr: `done ` attribute of the object for the
159- field will be set to the value -1.
160+ a Back or Cancel button) the :attr: `~FieldStorage. done ` attribute of the
161+ object for the field will be set to the value -1.
160162
161163The file upload draft standard entertains the possibility of uploading multiple
162164files from one field (using a recursive :mimetype: `multipart/\* ` encoding).
@@ -223,8 +225,8 @@ Therefore, the appropriate way to read form data values was to always use the
223225code which checks whether the obtained value is a single value or a list of
224226values. That's annoying and leads to less readable scripts.
225227
226- A more convenient approach is to use the methods :meth: `getfirst ` and
227- :meth: `getlist ` provided by this higher level interface.
228+ A more convenient approach is to use the methods :meth: `~FieldStorage. getfirst `
229+ and :meth: `~FieldStorage. getlist ` provided by this higher level interface.
228230
229231
230232.. method :: FieldStorage.getfirst(name, default=None)
0 commit comments