WebUtils.FieldStorage | index /usr/local/share/webware/WebUtils/FieldStorage.py

`FieldStorage.py
This module defines a subclass of the standard Python cgi.FieldStorage class
with an extra method that will allow a FieldStorage to parse a query string
even in a POST request.`

Modules

``

cgi | os | urllib |

Classes

``

cgi.FieldStorage
  FieldStorage

class FieldStorage(cgi.FieldStorage)

``

`Modified FieldStorage class for POST requests with query strings.
Parameters in the query string which have not been sent via POST are
appended to the field list. This is different from the behavior of
Python versions before 2.6 which completely ignored the query string in
POST request, but it's also different from the behavior of the later Python
versions which append values from the query string to values sent via POST
for parameters with the same name. With other words, our FieldStorage class
overrides the query string parameters with the parameters sent via POST.
As recommended by W3C in section B.2.2 of the HTML 4.01 specification,
we also support use of ';' in place of '&' as separator in query strings.
`

Methods defined here:

__init__(self, fp=None, headers=None, outerboundary='', environ={'MASTERMNT': '/z/poudriere-base/data/build/83i3...POUDRIERE_BUILD_TYPE': 'bulk', 'UNAME_p': 'i386'}, keep_blank_values=False, strict_parsing=False)

add_qs(self, qs)
  `Add all non-existing parameters from the given query string.`

Methods inherited from cgi.FieldStorage:

__contains__(self, key)
  `Dictionary style __contains__ method.`

__getattr__(self, name)

__getitem__(self, key)
  `Dictionary style indexing.`

__iter__(self)

__len__(self)
  `Dictionary style len(x) support.`

__nonzero__(self)

__repr__(self)
  `Return a printable representation.`

getfirst(self, key, default=None)
  `Return the first value received.`

getlist(self, key)
  `Return list of received values.`

getvalue(self, key, default=None)
  `Dictionary style get() method, including 'value' lookup.`

has_key(self, key)
  `Dictionary style has_key() method.`

keys(self)
  `Dictionary style keys() method.`

make_file(self, binary=None)
  `Overridable: return a readable & writable file.
  The file will be used as follows:
  - data is written to it
  - seek(0)
  - data is read from it
  The 'binary' argument is unused -- the file is always opened
  in binary mode.
  This version opens a temporary file for reading and writing,
  and immediately deletes (unlinks) it. The trick (on Unix!) is
  that the file can still be used, but it can't be opened by
  another process, and it will automatically be deleted when it
  is closed or when the current process terminates.
  If you want a more permanent file, you derive a class which
  overrides this method. If you want a visible temporary file
  that is nevertheless automatically deleted when the script
  terminates, try defining a __del__ method in a derived class
  which unlinks the temporary files you have created.`

read_binary(self)
  `Internal: read binary data.`

read_lines(self)
  `Internal: read lines until EOF or outerboundary.`

read_lines_to_eof(self)
  `Internal: read lines until EOF.`

read_lines_to_outerboundary(self)
  `Internal: read lines until outerboundary.`

read_multi(self, environ, keep_blank_values, strict_parsing)
  `Internal: read a part that is itself multipart.`

read_single(self)
  `Internal: read an atomic part.`

read_urlencoded(self)
  `Internal: read data in query string format.`

skip_lines(self)
  `Internal: skip lines until outer boundary if defined.`

Data and other attributes inherited from cgi.FieldStorage:

FieldStorageClass = None

bufsize = 8192