�
��c@sadZdZddklZddkZddkZddkZddkZddkZddk Z yddk
lZWn#ej
oddklZnXdddd d
ddd
ddddddddddgZ
dZead�Zd�Zd�Zeadaeeiddd�Zddd�Zddd�Zd �Zd!�Zdfd"��YZdfd#��YZde i fd$��YZd efd%��YZd
efd&��YZ defd'��YZ!eid(�Z"eeeed)�Z#eid*�Z$d+�Z%d,�Z&d-�Z'd.�Z(ed/�Z)d0d1�Z*e+d2joe"�ndS(3s�Support module for CGI (Common Gateway Interface) scripts.
This module defines a number of utilities for use by CGI scripts
written in Python.
s2.6i�(t
attrgetterN(tStringIOtMiniFieldStoragetFieldStoragetFormContentDicttSvFormContentDicttInterpFormContentDicttFormContenttparsetparse_qst parse_qsltparse_multiparttparse_headertprint_exceptiont
print_environt
print_formtprint_directorytprint_argumentstprint_environ_usagetescapetcGsato5to-yttd�aWq<tj
oq<Xntp
tantat|�dS(s�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).
taN(tlogfiletlogfptopentIOErrortnologtlogtdolog(tallargs((s/sys/lib/python/cgi.pytinitlog>s
cGsti||d�dS(s=Write a log message to the log file. See initlog() for docs.s
N(Rtwrite(tfmttargs((s/sys/lib/python/cgi.pyRascGsdS(s9Dummy function, assigned to log when logging is disabled.N((R((s/sys/lib/python/cgi.pyResicCs�|d
jo
ti}nd|jod|d<n|ddjot|d�\}}|djot||�SnX|djoDt|d�}to|tjo
td�n|i|�}nd }d
|jo'|o|d}n||d
}n9ti do*|o|d}n|ti d}n||d
<nKd
|jo|d
}n0ti doti d}nd }||d
<t
|||�S(sParse 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.
tREQUEST_METHODtGETtPOSTtCONTENT_TYPEsmultipart/form-datas!application/x-www-form-urlencodedtCONTENT_LENGTHsMaximum content length exceededRtQUERY_STRINGt&iN(tNonetsyststdinRRtinttmaxlent
ValueErrortreadtargvR (tfptenvirontkeep_blank_valueststrict_parsingtctypetpdicttclengthtqs((s/sys/lib/python/cgi.pyRss8
cCs\h}xOt|||�D];\}}||jo||i|�q|g||<qW|S(s�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.
(R
tappend(R8R3R4tdicttnametvalue((s/sys/lib/python/cgi.pyR �s
cCs>g}|id�D]#}|id�D]
}||q'q~}g}x�D]�|o|oqMn|idd�} t| �djo:|otd|f�n|o| id�q�qMnt| d�p|oUti| did d
��}
ti| did d
��}|i|
|f�qMqMW|S(s�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.
R(t;t=iisbad query field: %rRit+t (tsplittlenR.R9turllibtunquotetreplace(R8R3R4t_[1]ts1ts2tpairstrt
name_valuetnvR;R<((s/sys/lib/python/cgi.pyR
�s$@c Cs�d}d|jo|d}nt|�ptd|f�nd|}d|d}h}d}xK||jo=d}d}|o�ti|�} | id�}
|
o*yt|
�}Wq�tj
oq�Xn|djo4to|tjo
td�n|i|�}q#d}ng}xg|i �}|p|}Pn|d djo(|i
�}|||fjoPq�n|i|�q,|djoqin|djop|oe|d}|d
djo|d
}n |ddjo|d }n||d<di|�}q$n| d
}|pqint
|�\}
}|
djoqind|jo|d}nqi||jo||i|�qi|g||<qiW|S(s�Parse multipart input.
Arguments:
fp : input file
pdict: dictionary containing other parameters of content-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.
Also, FieldStorage protects itself better against certain DoS attacks
by limiting the size of the data read in one chunk. The API here
does not support that kind of protection. This also affects parse()
since it can call parse_multipart().
Rtboundarys&Invalid boundary in multipart form: %rs--i�scontent-lengthisMaximum content length exceededii�s
s
scontent-dispositions form-dataR;N(tvalid_boundaryR.R)t mimetoolstMessaget getheaderR,R-R/treadlinetstripR9tjoinR(R1R6RMtnextparttlastparttpartdictt
terminatortbytestdatatheadersR7tlinestlinetkeytparamsR;((s/sys/lib/python/cgi.pyR�sz
c
Cs"g}|id�D]}||i�q~}|id�i�}h}x�|D]�}|id�}|djo�|| i�i�}||di�} t| �djoU| d| djo
djno/| dd!} | idd �id
d�} n| ||<qRqRW||fS(sfParse a Content-type like header.
Return the main content-type and a dictionary of options.
R=iR>iii�t"s\\s\s\"(RARStpoptlowertfindRBRE(
R]RFtxtplistR^R6tptiR;R<((s/sys/lib/python/cgi.pyRMs0
9
"cBsPeZdZdZdZdZdZhZdZ hZ
hZd�Zd�Z
RS(s=Like FieldStorage, for use when no file uploads are possible.cCs||_||_dS(s&Constructor from field name and value.N(R;R<(tselfR;R<((s/sys/lib/python/cgi.pyt__init__ss cCsd|i|ifS(s Return printable representation.sMiniFieldStorage(%r, %r)(R;R<(Rh((s/sys/lib/python/cgi.pyt__repr__ysN(t__name__t
__module__t__doc__R)tfilenametlistttypetfilettype_optionstdispositiontdisposition_optionsR[RiRj(((s/sys/lib/python/cgi.pyRes cBs�eZdZdddeiddd�Zd�Zd�Zd�Z d�Z
dd�Zdd �Zd
�Z
d�Zd�Zd
�Zd�Zd�ZdZd�Zd�ZdZd�Zd�Zd�Zd�Zd�Zd�Zdd�ZRS(s�Store a sequence of fields, reading multipart/form-data.
This class provides naming, typing, files stored on disk, and
more. At the top level, it is accessible like a dictionary, whose
keys are the field names. (Note: None can occur as a field name.)
The items are either a Python list (if there's multiple values) or
another FieldStorage or MiniFieldStorage object. If it's a single
object, it has the following attributes:
name: the field name, if specified; otherwise None
filename: the filename, if specified; otherwise None; this is the
client side filename, *not* the file name on which it is
stored (that's a temporary file you don't deal with)
value: the value as a *string*; for file uploads, this
transparently reads the file every time you request the value
file: the file(-like) object from which you can read the data;
None if the data is stored a simple string
type: the content-type, or None if not specified
type_options: dictionary of options specified on the content-type
line
disposition: content-disposition, or None if not specified
disposition_options: dictionary of corresponding options
headers: a dictionary(-like) object (sometimes rfc822.Message or a
subclass thereof) containing *all* headers
The class is subclassable, mostly for the purpose of overriding
the make_file() method, which is called internally to come up with
a file open for reading and writing. This makes it possible to
override the default choice of storing all files in a temporary
directory and unlinking them as soon as they have been opened.
Ric
Cshd}||_||_d|jo|di�}n|djp
|djopd|jo|d}n&tidotid}nd}t|�}|djohdd<}q�n|djoch}|d jod|d<nd
|jo|d
|d<nd|jo|d|d<q3n|pti|_||_ ||_
dh} }
d
|i jot|i d
�\} }
n| |_|
|_
d|_d|
jo|
d|_nd|_d|
jo|
d|_nd|i jot|i d�\}}
n6|i
p
|d jodh}}
ndh}}
||_|
|_d|_d|
jo|
d|_nd}d|i joRyt|i d�}Wntj
onXto|tjo
td�q�||_d|_|_d|_|djo|i�n3|d djo|i|||�n|i�dS(sConstructor. Read multipart/* until last part.
Arguments, all optional:
fp : file pointer; default: sys.stdin
(not used when the request method is GET)
headers : header dictionary-like object; default:
taken from environ as per CGI spec
outerboundary : terminating multipart boundary
(for internal use only)
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.
R#R"tHEADR'iRs!application/x-www-form-urlencodedscontent-typeR$R%R&scontent-lengthscontent-dispositionR;Rns
text/plainRMi�sMaximum content length exceededii
s
multipart/N(R3R4tupperR*R0RR)R+R1R[t
outerboundaryRRsRtR;RnRpRrt
innerboundaryR,R.R-tlengthRoRqtdonetread_urlencodedt
read_multitread_single(
RhR1R[RwR2R3R4tmethodR8tcdispR6R5tclen((s/sys/lib/python/cgi.pyRi�s~
cCsd|i|i|ifS(s"Return a printable representation.sFieldStorage(%r, %r, %r)(R;RnR<(Rh((s/sys/lib/python/cgi.pyRjscCst|i��S(N(titertkeys(Rh((s/sys/lib/python/cgi.pyt__iter__scCs~|djo
t|�n|io3|iid�|ii�}|iid�n$|idj o
|i}nd}|S(NR<i(tAttributeErrorRqtseekR/RoR)(RhR;R<((s/sys/lib/python/cgi.pyt__getattr__"s
cCs�|idjo
td�ng}x2|iD]'}|i|jo|i|�q-q-W|p
t|�nt|�djo|dSn|SdS(sDictionary style indexing.s
not indexableiiN(RoR)t TypeErrorR;R9tKeyErrorRB(RhR^tfoundtitem((s/sys/lib/python/cgi.pyt__getitem__/s
%
cCsZ||joE||}t|�tg�jottd�|�SqV|iSn|SdS(s8Dictionary style get() method, including 'value' lookup.R<N(RptmapRR<(RhR^tdefaultR<((s/sys/lib/python/cgi.pytgetvalue=s
cCsR||jo=||}t|�tg�jo|diSqN|iSn|SdS(s! Return the first value received.iN(RpR<(RhR^R�R<((s/sys/lib/python/cgi.pytgetfirstHs
cCs]||joH||}t|�tg�jottd�|�SqY|igSngSdS(s Return list of received values.R<N(RpR�RR<(RhR^R<((s/sys/lib/python/cgi.pytgetlistSs
cCs_|idjo
td�ng}x5|iD]*}|i|jo|i|i�q-q-W|S(sDictionary style keys() method.s
not indexableN(RoR)R�R;R9(RhR�R�((s/sys/lib/python/cgi.pyR�^s
(cCsM|idjo
td�nx)|iD]}|i|jotSq'q'WtS(s"Dictionary style has_key() method.s
not indexableN(RoR)R�R;tTruetFalse(RhR^R�((s/sys/lib/python/cgi.pythas_keygs
cCsM|idjo
td�nx)|iD]}|i|jotSq'q'WtS(s%Dictionary style __contains__ method.s
not indexableN(RoR)R�R;R�R�(RhR^R�((s/sys/lib/python/cgi.pyt__contains__os
cCst|i��S(s Dictionary style len(x) support.(RBR�(Rh((s/sys/lib/python/cgi.pyt__len__wscCso|ii|i�}g|_}x<t||i|i�D]"\}}|it||��q;W|i �dS(s+Internal: read data in query string format.N(
R1R/RyRoR
R3R4R9Rt
skip_lines(RhR8RoR^R<((s/sys/lib/python/cgi.pyR{{s
cCs�|i}t|�ptd|f�ng|_|ip|i}||ih||||�}xO|ipDti |i�}||i|||||�}|ii
|�qgW|i�dS(s/Internal: read a part that is itself multipart.s&Invalid boundary in multipart form: %rN(RxRNR.RotFieldStorageClasst __class__R1Rztrfc822RPR9R�(RhR2R3R4tibtklasstpartR[((s/sys/lib/python/cgi.pyR|�s
cCsF|idjo|i�|i�n|i�|iid�dS(sInternal: read an atomic part.iN(Rytread_binaryR�t
read_linesRqR�(Rh((s/sys/lib/python/cgi.pyR}�s
iicCs�|id�|_|i}|djolxi|djoW|iit||i��}|pd|_Pn|ii|�|t |�}q+WndS(sInternal: read binary data.tbii�N(
t make_fileRqRyR1R/tmintbufsizeRzRRB(RhttodoRZ((s/sys/lib/python/cgi.pyR��s
cCs9t�|_|_|io|i�n|i�dS(s0Internal: read lines until EOF or outerboundary.N(RRqt_FieldStorage__fileRwtread_lines_to_outerboundarytread_lines_to_eof(Rh((s/sys/lib/python/cgi.pyR��s
cCs�|idj o\|ii�t|�djo8|id�|_|ii|ii��d|_qln|ii|�dS(Ni�R(R�R)ttellRBR�RqRR�(RhR]((s/sys/lib/python/cgi.pyt__write�s cCs>x7|iid�}|pd|_Pn|i|�qdS(sInternal: read lines until EOF.iii�Ni(R1RRRzt_FieldStorage__write(RhR]((s/sys/lib/python/cgi.pyR��s cCs"d|i}|d}d}t}x�iid�}|pd|_Pn|d djoD|o=|i�}||joPn||jod|_Pq�n|}|ddjod}|d }t}n8|dd jod }|d }t}n
d}t}|i||�q&d
S(s)Internal: read lines until outerboundary.s--Riii�ii�s
s
Ni(RwR�R1RRRzRSR�R�(Rhtnexttlasttdelimtlast_line_lfendR]tstrippedlinetodelim((s/sys/lib/python/cgi.pyR��s8
cCs�|ip
|iodSnd|i}|d}t}x�|iid�}|pd|_Pn|d djoD|o=|i�}||joPn||jod|_Pq�n|id�}q=dS( s5Internal: skip lines until outer boundary if defined.Ns--iii�is
i(RwRzR�R1RRRStendswith(RhR�R�R�R]R�((s/sys/lib/python/cgi.pyR��s$
cCsddk}|id�S(s�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.
i�Nsw+b(ttempfilet
TemporaryFile(RhtbinaryR�((s/sys/lib/python/cgi.pyR��sNi (RkRlRmR)tosR2RiRjR�R�R�R�R�R�R�R�R�R�R{R�R|R}R�R�R�R�R�R�R�R�(((s/sys/lib/python/cgi.pyR~s4) p
cBseZdZeid�ZRS(sxForm content as dictionary with a list of values per field.
form = FormContentDict()
form[key] -> [value, value, ...]
key in form -> Boolean
form.keys() -> [key, key, ...]
form.values() -> [[val, val, ...], [val, val, ...], ...]
form.items() -> [(key, [val, val, ...]), (key, [val, val, ...]), ...]
form.dict == {key: [val, val, ...], ...}
cCs*td|�|_|_|d|_dS(NR2R'(RR:RZtquery_string(RhR2((s/sys/lib/python/cgi.pyRi*s(RkRlRmR�R2Ri(((s/sys/lib/python/cgi.pyRscBs2eZdZd�Zd�Zd�Zd�ZRS(s�Form content as dictionary expecting a single value per field.
If you only expect a single value for each field, then form[key]
will return that single value. It will raise an IndexError if
that expectation is not true. If you expect a field to have
possible multiple values, than you can use form.getlist(key) to
get all of the values. values() and items() are a compromise:
they return single strings where there is a single value, and
lists of strings otherwise.
cCs6t|i|�djo
td�n|i|dS(Nisexpecting a single valuei(RBR:t
IndexError(RhR^((s/sys/lib/python/cgi.pyR�;s
cCs|i|S(N(R:(RhR^((s/sys/lib/python/cgi.pyR�?scCsYg}xL|ii�D];}t|�djo|i|d�q|i|�qW|S(Nii(R:tvaluesRBR9(RhtresultR<((s/sys/lib/python/cgi.pyR�AscCskg}x^|ii�D]M\}}t|�djo|i||df�q|i||f�qW|S(Nii(R:titemsRBR9(RhR�R^R<((s/sys/lib/python/cgi.pyR�Hs(RkRlRmR�R�R�R�(((s/sys/lib/python/cgi.pyR/s
cBs)eZdZd�Zd�Zd�ZRS(s7This class is present for backwards compatibility only.cCsyti||�}|ddjoLyt|�SWqotj
o+yt|�SWqktj
oqkXqoXn|i�S(Nis
0123456789+-.(RR�R,R.tfloatRS(RhR^tv((s/sys/lib/python/cgi.pyR�SscCs`g}xS|i�D]E}y|i||�Wqtj
o|i|i|�qXqW|S(N(R�R9R�R:(RhR�R^((s/sys/lib/python/cgi.pyR�[s
cCslg}x_|i�D]Q}y|i|||f�Wqtj
o!|i||i|f�qXqW|S(N(R�R9R�R:(RhR�R^((s/sys/lib/python/cgi.pyR�cs
#(RkRlRmR�R�R�(((s/sys/lib/python/cgi.pyRQs cBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s7This class is present for backwards compatibility only.cCs'||ijo|i|SndSdS(N(R:R)(RhR^((s/sys/lib/python/cgi.pyR�oscCsM||ijo5t|i|�|jo|i||SqIdSndSdS(N(R:RBR)(RhR^tlocation((s/sys/lib/python/cgi.pyt
indexed_valuers
cCs+||ijo|i|dSndSdS(Ni(R:R)(RhR^((s/sys/lib/python/cgi.pyR<xs#cCst|i|�S(N(RBR:(RhR^((s/sys/lib/python/cgi.pyRy{scCs1||ijo|i|di�SndSdS(Ni(R:RSR)(RhR^((s/sys/lib/python/cgi.pytstripped}s)cCs|iS(N(R:(Rh((s/sys/lib/python/cgi.pytpars�s( RkRlRmR�R�R<RyR�R�(((s/sys/lib/python/cgi.pyRms cCs�dGHHtit_yWt�}t�t�t|�t|�t�d�}|d�}dGH|�Wnt �nXdGHda
y/t�}t�t�t|�t|�Wnt �nXdS(s�Robust test CGI script, usable as main program.
Write minimal HTTP headers and dump all information provided to
the script in HTML form.
sContent-type: text/htmlcRsddUdS(Ns,testing print_exception() -- <I>italics?</I>((((s/sys/lib/python/cgi.pytf�scSs|�dS(N((R�((s/sys/lib/python/cgi.pytg�ss9<H3>What follows is a test, not an actual exception:</H3>s*<H1>Second try with a small maxlen...</H1>i2N(R*tstdouttstderrRRRRRRR
R-(R2tformR�R�((s/sys/lib/python/cgi.pyttest�s4
cCs�|djoti�\}}}nddk}HdGH|i||�|i||�}dtdi|d ��t|d�fGH~dS(Ni�s+<H3>Traceback (most recent call last):</H3>s<PRE>%s<B>%s</B></PRE>R(R)R*texc_infot tracebackt format_tbtformat_exception_onlyRRT(RpR<ttbtlimitR�Ro((s/sys/lib/python/cgi.pyR
�s
cCs]|i�}|i�HdGHdGHx/|D]'}dGt|�GdGt||�GHq(WdGHHdS(s#Dump the shell environment as HTML.s<H3>Shell Environment:</H3>s<DL>s<DT>s<DD>s</DL>N(R�tsortR(R2R�R^((s/sys/lib/python/cgi.pyR�s
%cCs�|i�}|i�HdGH|p dGHndGHx^|D]V}dt|�dG||}dttt|���dGHdtt|��GHq8Wd GHHd
S(s$Dump the contents of a form as HTML.s<H3>Form Contents:</H3>s<P>No form fields.s<DL>s<DT>t:s<i>s</i>s<DD>s</DL>N(R�R�RtreprRp(R�R�R^R<((s/sys/lib/python/cgi.pyR�s
cCsVHdGHyti�}Wn-tij
o}dGtt|��GHn
Xt|�GHHdS(s#Dump the current directory as HTML.s#<H3>Current Working Directory:</H3>s os.error:N(R�tgetcwdterrorRtstr(tpwdtmsg((s/sys/lib/python/cgi.pyR�scCsHdGHHtiGHHdS(Ns <H3>Command Line Arguments:</H3>(R*R0(((s/sys/lib/python/cgi.pyR�s
cCs dGHdS(s9Dump a list of environment variables used by CGI as HTML.s�
<H3>These environment variables could have been set:</H3>
<UL>
<LI>AUTH_TYPE
<LI>CONTENT_LENGTH
<LI>CONTENT_TYPE
<LI>DATE_GMT
<LI>DATE_LOCAL
<LI>DOCUMENT_NAME
<LI>DOCUMENT_ROOT
<LI>DOCUMENT_URI
<LI>GATEWAY_INTERFACE
<LI>LAST_MODIFIED
<LI>PATH
<LI>PATH_INFO
<LI>PATH_TRANSLATED
<LI>QUERY_STRING
<LI>REMOTE_ADDR
<LI>REMOTE_HOST
<LI>REMOTE_IDENT
<LI>REMOTE_USER
<LI>REQUEST_METHOD
<LI>SCRIPT_NAME
<LI>SERVER_NAME
<LI>SERVER_PORT
<LI>SERVER_PROTOCOL
<LI>SERVER_ROOT
<LI>SERVER_SOFTWARE
</UL>
In addition, HTTP headers sent by the server may be passed in the
environment as well. Here are some common variable names:
<UL>
<LI>HTTP_ACCEPT
<LI>HTTP_CONNECTION
<LI>HTTP_HOST
<LI>HTTP_PRAGMA
<LI>HTTP_REFERER
<LI>HTTP_USER_AGENT
</UL>
N((((s/sys/lib/python/cgi.pyR�s)cCsW|idd�}|idd�}|idd�}|o|idd�}n|S( s�Replace special characters "&", "<" and ">" to HTML-safe sequences.
If the optional flag quote is true, the quotation mark character (")
is also translated.R(s&t<s<t>s>R`s"(RE(tstquote((s/sys/lib/python/cgi.pyRss^[ -~]{0,200}[!-~]$cCsddk}|i||�S(Ni�(tretmatch(R�t_vb_patternR�((s/sys/lib/python/cgi.pyRN&st__main__(,Rmt__version__toperatorRR*R�RCROR�tUserDictt cStringIORtImportErrort__all__RR)RRRRRR-R2RR R
RRRRRRRRR�R
RRRRRRRNRk(((s/sys/lib/python/cgi.pys<module>s` # 5) b �"' /
|