Vega strike Python Modules doc
0.5.1
Documentation of the " Modules " folder of Vega strike
|
Data Structures | |
class | MiniFieldStorage |
class | FieldStorage |
class | FormContentDict |
class | SvFormContentDict |
class | InterpFormContentDict |
class | FormContent |
Functions | |
def | initlog |
def | dolog |
def | nolog |
def | parse |
def | parse_qs |
def | parse_qsl |
def | parse_multipart |
def | parse_header |
def | test |
def | print_exception |
def | print_environ |
def | print_form |
def | print_directory |
def | print_arguments |
def | print_environ_usage |
def | escape |
def | valid_boundary |
Variables | |
string | __version__ = "2.6" |
list | __all__ |
string | logfile = "" |
logfp = None | |
log = initlog | |
int | maxlen = 0 |
def cgi.escape | ( | s, | |
quote = None |
|||
) |
Replace special characters '&', '<' and '>' by SGML entities.
def cgi.initlog | ( | allargs) |
Write a log message, if there is a log file. Even though this function is called initlog(), you should always use log(); log is a variable that is set either to initlog (initially), to dolog (once the log file has been opened), or to nolog (when logging is disabled). The first argument is a format string; the remaining arguments (if any) are arguments to the % operator, so e.g. log("%s: %s", "a", "b") will write "a: b" to the log file, followed by a newline. If the global logfp is not None, it should be a file object to which log data is written. If the global logfp is None, the global logfile may be a string giving a filename to open, in append mode. This file should be world writable!!! If the file can't be opened, logging is silently disabled (since there is no safe place where we could send an error message).
Definition at line 58 of file cgi.py.
References aifc.open().
def cgi.nolog | ( | allargs) |
def cgi.parse | ( | fp = None , |
|
environ = os.environ , |
|||
keep_blank_values = 0 , |
|||
strict_parsing = 0 |
|||
) |
Parse a query in the environment or from a file (default stdin) Arguments, all optional: fp : file pointer; default: sys.stdin environ : environment dictionary; default: os.environ keep_blank_values: flag indicating whether blank values in URL encoded forms should be treated as blank strings. A true value indicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception.
Definition at line 111 of file cgi.py.
References parse_header(), parse_multipart(), and parse_qs().
def cgi.parse_header | ( | line) |
Parse a Content-type like header. Return the main content-type and a dictionary of options.
Definition at line 319 of file cgi.py.
References string.lower(), and string.strip().
def cgi.parse_multipart | ( | fp, | |
pdict | |||
) |
Parse multipart input. Arguments: fp : input file pdict: dictionary containing other parameters of conten-type header Returns a dictionary just like parse_qs(): keys are the field names, each value is a list of values for that field. This is easy to use but not much good if you are expecting megabytes to be uploaded -- in that case, use the FieldStorage class instead which is much more flexible. Note that content-type is the raw, unparsed contents of the content-type header. XXX This does not parse nested multipart parts -- use FieldStorage for that. XXX This should really be subsumed by FieldStorage altogether -- no point in having two implementations of the same parsing algorithm.
Definition at line 225 of file cgi.py.
References reconvert.append, dospath.join(), parse_header(), and valid_boundary().
def cgi.parse_qs | ( | qs, | |
keep_blank_values = 0 , |
|||
strict_parsing = 0 |
|||
) |
Parse a query given as a string argument. Arguments: qs: URL-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in URL encoded queries should be treated as blank strings. A true value indicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception.
Definition at line 164 of file cgi.py.
References reconvert.append, and parse_qsl().
def cgi.parse_qsl | ( | qs, | |
keep_blank_values = 0 , |
|||
strict_parsing = 0 |
|||
) |
Parse a query given as a string argument. Arguments: qs: URL-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in URL encoded queries should be treated as blank strings. A true value indicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. Returns a list, as G-d intended.
Definition at line 190 of file cgi.py.
References pydoc.replace(), and urllib.unquote().
def cgi.print_directory | ( | ) |
Dump the current directory as HTML.
Definition at line 956 of file cgi.py.
References escape(), and locale.str().
def cgi.print_environ | ( | environ = os.environ ) |
def cgi.print_environ_usage | ( | ) |
def cgi.print_exception | ( | type = None , |
|
value = None , |
|||
tb = None , |
|||
limit = None |
|||
) |
Definition at line 913 of file cgi.py.
References escape(), traceback.format_exception_only(), traceback.format_tb(), and dospath.join().
def cgi.print_form | ( | form) |
def cgi.test | ( | environ = os.environ ) |
Robust test CGI script, usable as main program. Write minimal HTTP headers and dump all information provided to the script in HTML form.
Definition at line 873 of file cgi.py.
References aifc.f, aifc.g, print_arguments(), print_directory(), print_environ(), print_environ_usage(), print_exception(), and print_form().
def cgi.valid_boundary | ( | s, | |
_vb_pattern = "^[ -~]{0 |
|||
) |
list __all__ |