Name
getvalue
Synopsis
f.getvalue(key,default=None)
Like
f
[
key
].value
when
f
.has_key(
key
),
otherwise returns default.
getvalue is slightly less convenient than methods
getfirst or getlist; the only
reason to use getvalue is if your script must
remain compatible with old versions of Python, since methods
getfirst and getlist were
introduced in Python 2.2.
An instance f of class
FieldStorage supplies the following attributes:
-
disposition The Content-Disposition header, or
Noneif no such header is present-
disposition_options A mapping of all the options in the Content-Disposition header, if any
-
headers A mapping of all headers, normally an instance of the
rfc822.Messageclass covered in Chapter 21-
file A file-like object from which you can read the control’s value, if applicable;
Noneif the value is held in memory as a string, as happens for most controls-
filename The filename as specified by the client, for
filecontrols; otherwiseNone-
name The
nameattribute of the control, orNoneif no such attribute is present-
type The Content-Type header, or
Noneif no such header is present-
type_options A mapping of all the options in the Content-Type header, if any
-
value The control’s value as a string; if
fis keeping the control’s value in a file, thenfimplicitly reads the file into memory each time you accessf.value
In most cases, attribute value is all you need.
Other attributes are useful for file controls, which may have very large values and metadata such ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access