/
usr
/
lib
/
python2.6
/
/usr/lib/python2.6
mkdir
upload
Name
Size
Mode
Actions
bsddb/
-
0755
rm
compiler/
-
0755
rm
config/
-
0755
rm
ctypes/
-
0755
rm
curses/
-
0755
rm
distutils/
-
0755
rm
email/
-
0755
rm
encodings/
-
0755
rm
hotshot/
-
0755
rm
idlelib/
-
0755
rm
json/
-
0755
rm
lib-dynload/
-
0755
rm
lib2to3/
-
0755
rm
logging/
-
0755
rm
multiprocessing/
-
0755
rm
plat-linux2/
-
0755
rm
site-packages/
-
0755
rm
sqlite3/
-
0755
rm
test/
-
0755
rm
wsgiref/
-
0755
rm
xml/
-
0755
rm
abc.py
7034
0644
edit
dl
rm
abc.pyc
6049
0644
edit
dl
rm
abc.pyo
5991
0644
edit
dl
rm
aifc.py
33188
0644
edit
dl
rm
aifc.pyc
29424
0644
edit
dl
rm
aifc.pyo
29424
0644
edit
dl
rm
anydbm.py
2620
0644
edit
dl
rm
anydbm.pyc
2769
0644
edit
dl
rm
anydbm.pyo
2769
0644
edit
dl
rm
ast.py
11347
0644
edit
dl
rm
ast.pyc
12732
0644
edit
dl
rm
ast.pyo
12732
0644
edit
dl
rm
asynchat.py
11402
0644
edit
dl
rm
asynchat.pyc
8677
0644
edit
dl
rm
asynchat.pyo
8677
0644
edit
dl
rm
asyncore.py
20061
0644
edit
dl
rm
asyncore.pyc
18334
0644
edit
dl
rm
asyncore.pyo
18334
0644
edit
dl
rm
atexit.py
1705
0644
edit
dl
rm
atexit.pyc
2203
0644
edit
dl
rm
atexit.pyo
2203
0644
edit
dl
rm
audiodev.py
7597
0644
edit
dl
rm
audiodev.pyc
8483
0644
edit
dl
rm
audiodev.pyo
8483
0644
edit
dl
rm
base64.py
11335
0755
edit
dl
rm
base64.pyc
10967
0644
edit
dl
rm
base64.pyo
10967
0644
edit
dl
rm
BaseHTTPServer.py
21974
0644
edit
dl
rm
BaseHTTPServer.pyc
21535
0644
edit
dl
rm
BaseHTTPServer.pyo
21535
0644
edit
dl
rm
Bastion.py
5744
0644
edit
dl
rm
Bastion.pyc
6637
0644
edit
dl
rm
Bastion.pyo
6637
0644
edit
dl
rm
bdb.py
20597
0644
edit
dl
rm
bdb.pyc
18449
0644
edit
dl
rm
bdb.pyo
18449
0644
edit
dl
rm
binhex.py
14878
0644
edit
dl
rm
binhex.pyc
15773
0644
edit
dl
rm
binhex.pyo
15773
0644
edit
dl
rm
bisect.py
2662
0644
edit
dl
rm
bisect.pyc
3163
0644
edit
dl
rm
bisect.pyo
3163
0644
edit
dl
rm
calendar.py
23110
0644
edit
dl
rm
calendar.pyc
28007
0644
edit
dl
rm
calendar.pyo
28007
0644
edit
dl
rm
cgi.py
34478
0755
edit
dl
rm
cgi.pyc
32680
0644
edit
dl
rm
cgi.pyo
32680
0644
edit
dl
rm
CGIHTTPServer.py
12773
0644
edit
dl
rm
CGIHTTPServer.pyc
10794
0644
edit
dl
rm
CGIHTTPServer.pyo
10794
0644
edit
dl
rm
cgitb.py
12155
0644
edit
dl
rm
cgitb.pyc
12425
0644
edit
dl
rm
cgitb.pyo
12425
0644
edit
dl
rm
chunk.py
5372
0644
edit
dl
rm
chunk.pyc
5623
0644
edit
dl
rm
chunk.pyo
5623
0644
edit
dl
rm
cmd.py
14962
0644
edit
dl
rm
cmd.pyc
13914
0644
edit
dl
rm
cmd.pyo
13914
0644
edit
dl
rm
code.py
10217
0644
edit
dl
rm
code.pyc
10395
0644
edit
dl
rm
code.pyo
10395
0644
edit
dl
rm
codecs.py
35266
0644
edit
dl
rm
codecs.pyc
36533
0644
edit
dl
rm
codecs.pyo
36533
0644
edit
dl
rm
codeop.py
5999
0644
edit
dl
rm
codeop.pyc
6616
0644
edit
dl
rm
codeop.pyo
6616
0644
edit
dl
rm
collections.py
13730
0644
edit
dl
rm
collections.pyc
14392
0644
edit
dl
rm
collections.pyo
14339
0644
edit
dl
rm
colorsys.py
3459
0644
edit
dl
rm
colorsys.pyc
4025
0644
edit
dl
rm
colorsys.pyo
4025
0644
edit
dl
rm
commands.py
2543
0644
edit
dl
rm
commands.pyc
2477
0644
edit
dl
rm
commands.pyo
2477
0644
edit
dl
rm
compileall.py
5285
0644
edit
dl
rm
compileall.pyc
4989
0644
edit
dl
rm
compileall.pyo
4989
0644
edit
dl
rm
ConfigParser.py
25989
0644
edit
dl
rm
ConfigParser.pyc
23755
0644
edit
dl
rm
ConfigParser.pyo
23755
0644
edit
dl
rm
contextlib.py
4136
0644
edit
dl
rm
contextlib.pyc
4127
0644
edit
dl
rm
contextlib.pyo
4127
0644
edit
dl
rm
Cookie.py
25054
0644
edit
dl
rm
Cookie.pyc
22067
0644
edit
dl
rm
Cookie.pyo
22067
0644
edit
dl
rm
cookielib.py
64726
0644
edit
dl
rm
cookielib.pyc
55176
0644
edit
dl
rm
cookielib.pyo
54985
0644
edit
dl
rm
copy.py
11177
0644
edit
dl
rm
copy.pyc
11629
0644
edit
dl
rm
copy.pyo
11533
0644
edit
dl
rm
copy_reg.py
6800
0644
edit
dl
rm
copy_reg.pyc
5156
0644
edit
dl
rm
copy_reg.pyo
5110
0644
edit
dl
rm
cProfile.py
6337
0755
edit
dl
rm
cProfile.pyc
6211
0644
edit
dl
rm
cProfile.pyo
6211
0644
edit
dl
rm
crypt.py
2229
0644
edit
dl
rm
crypt.pyc
3043
0644
edit
dl
rm
crypt.pyo
3043
0644
edit
dl
rm
csv.py
15730
0644
edit
dl
rm
csv.pyc
13170
0644
edit
dl
rm
csv.pyo
13170
0644
edit
dl
rm
dbhash.py
535
0644
edit
dl
rm
dbhash.pyc
756
0644
edit
dl
rm
dbhash.pyo
756
0644
edit
dl
rm
decimal.py
199273
0644
edit
dl
rm
decimal.pyc
155185
0644
edit
dl
rm
decimal.pyo
155119
0644
edit
dl
rm
difflib.py
81080
0644
edit
dl
rm
difflib.pyc
61093
0644
edit
dl
rm
difflib.pyo
61039
0644
edit
dl
rm
dircache.py
1126
0644
edit
dl
rm
dircache.pyc
1576
0644
edit
dl
rm
dircache.pyo
1576
0644
edit
dl
rm
dis.py
6449
0644
edit
dl
rm
dis.pyc
6350
0644
edit
dl
rm
dis.pyo
6350
0644
edit
dl
rm
doctest.py
101516
0644
edit
dl
rm
doctest.pyc
80782
0644
edit
dl
rm
doctest.pyo
80494
0644
edit
dl
rm
DocXMLRPCServer.py
10599
0644
edit
dl
rm
DocXMLRPCServer.pyc
9921
0644
edit
dl
rm
DocXMLRPCServer.pyo
9813
0644
edit
dl
rm
dumbdbm.py
8820
0644
edit
dl
rm
dumbdbm.pyc
6547
0644
edit
dl
rm
dumbdbm.pyo
6547
0644
edit
dl
rm
dummy_thread.py
4418
0644
edit
dl
rm
dummy_thread.pyc
5383
0644
edit
dl
rm
dummy_thread.pyo
5383
0644
edit
dl
rm
dummy_threading.py
2804
0644
edit
dl
rm
dummy_threading.pyc
1295
0644
edit
dl
rm
dummy_threading.pyo
1295
0644
edit
dl
rm
filecmp.py
9470
0644
edit
dl
rm
filecmp.pyc
9592
0644
edit
dl
rm
filecmp.pyo
9592
0644
edit
dl
rm
fileinput.py
14143
0644
edit
dl
rm
fileinput.pyc
14870
0644
edit
dl
rm
fileinput.pyo
14870
0644
edit
dl
rm
fnmatch.py
3239
0644
edit
dl
rm
fnmatch.pyc
3567
0644
edit
dl
rm
fnmatch.pyo
3567
0644
edit
dl
rm
formatter.py
14911
0644
edit
dl
rm
formatter.pyc
19149
0644
edit
dl
rm
formatter.pyo
19149
0644
edit
dl
rm
fpformat.py
4699
0644
edit
dl
rm
fpformat.pyc
4719
0644
edit
dl
rm
fpformat.pyo
4719
0644
edit
dl
rm
fractions.py
20073
0644
edit
dl
rm
fractions.pyc
18041
0644
edit
dl
rm
fractions.pyo
18041
0644
edit
dl
rm
ftplib.py
29197
0644
edit
dl
rm
ftplib.pyc
28387
0644
edit
dl
rm
ftplib.pyo
28387
0644
edit
dl
rm
functools.py
2162
0644
edit
dl
rm
functools.pyc
1921
0644
edit
dl
rm
functools.pyo
1921
0644
edit
dl
rm
genericpath.py
3020
0644
edit
dl
rm
genericpath.pyc
3272
0644
edit
dl
rm
genericpath.pyo
3272
0644
edit
dl
rm
getopt.py
7328
0644
edit
dl
rm
getopt.pyc
6710
0644
edit
dl
rm
getopt.pyo
6663
0644
edit
dl
rm
getpass.py
5534
0644
edit
dl
rm
getpass.pyc
4740
0644
edit
dl
rm
getpass.pyo
4740
0644
edit
dl
rm
gettext.py
19968
0644
edit
dl
rm
gettext.pyc
15674
0644
edit
dl
rm
gettext.pyo
15674
0644
edit
dl
rm
glob.py
2249
0644
edit
dl
rm
glob.pyc
2395
0644
edit
dl
rm
glob.pyo
2395
0644
edit
dl
rm
gzip.py
16754
0644
edit
dl
rm
gzip.pyc
14322
0644
edit
dl
rm
gzip.pyo
14322
0644
edit
dl
rm
hashlib.py
4427
0644
edit
dl
rm
hashlib.pyc
3975
0644
edit
dl
rm
hashlib.pyo
3975
0644
edit
dl
rm
heapq.py
15995
0644
edit
dl
rm
heapq.pyc
12668
0644
edit
dl
rm
heapq.pyo
12668
0644
edit
dl
rm
hmac.py
4531
0644
edit
dl
rm
hmac.pyc
4489
0644
edit
dl
rm
hmac.pyo
4489
0644
edit
dl
rm
htmlentitydefs.py
18054
0644
edit
dl
rm
htmlentitydefs.pyc
6369
0644
edit
dl
rm
htmlentitydefs.pyo
6369
0644
edit
dl
rm
htmllib.py
12869
0644
edit
dl
rm
htmllib.pyc
20202
0644
edit
dl
rm
htmllib.pyo
20202
0644
edit
dl
rm
HTMLParser.py
13576
0644
edit
dl
rm
HTMLParser.pyc
12198
0644
edit
dl
rm
HTMLParser.pyo
11890
0644
edit
dl
rm
httplib.py
48797
0644
edit
dl
rm
httplib.pyc
37578
0644
edit
dl
rm
httplib.pyo
37382
0644
edit
dl
rm
ihooks.py
17452
0644
edit
dl
rm
ihooks.pyc
20699
0644
edit
dl
rm
ihooks.pyo
20620
0644
edit
dl
rm
imaplib.py
47771
0644
edit
dl
rm
imaplib.pyc
45027
0644
edit
dl
rm
imaplib.pyo
42287
0644
edit
dl
rm
imghdr.py
3544
0644
edit
dl
rm
imghdr.pyc
4873
0644
edit
dl
rm
imghdr.pyo
4873
0644
edit
dl
rm
imputil.py
26009
0644
edit
dl
rm
imputil.pyc
15959
0644
edit
dl
rm
imputil.pyo
15787
0644
edit
dl
rm
inspect.py
38189
0644
edit
dl
rm
inspect.pyc
37033
0644
edit
dl
rm
inspect.pyo
37033
0644
edit
dl
rm
io.py
66165
0644
edit
dl
rm
io.pyc
62712
0644
edit
dl
rm
io.pyo
62712
0644
edit
dl
rm
keyword.py
1997
0755
edit
dl
rm
keyword.pyc
2113
0644
edit
dl
rm
keyword.pyo
2113
0644
edit
dl
rm
linecache.py
4128
0644
edit
dl
rm
linecache.pyc
3256
0644
edit
dl
rm
linecache.pyo
3256
0644
edit
dl
rm
locale.py
82674
0644
edit
dl
rm
locale.pyc
46620
0644
edit
dl
rm
locale.pyo
46620
0644
edit
dl
rm
macpath.py
6253
0644
edit
dl
rm
macpath.pyc
7669
0644
edit
dl
rm
macpath.pyo
7669
0644
edit
dl
rm
macurl2path.py
3275
0644
edit
dl
rm
macurl2path.pyc
2815
0644
edit
dl
rm
macurl2path.pyo
2815
0644
edit
dl
rm
mailbox.py
75824
0644
edit
dl
rm
mailbox.pyc
75633
0644
edit
dl
rm
mailbox.pyo
75584
0644
edit
dl
rm
mailcap.py
8402
0644
edit
dl
rm
mailcap.pyc
8051
0644
edit
dl
rm
mailcap.pyo
8051
0644
edit
dl
rm
markupbase.py
14350
0644
edit
dl
rm
markupbase.pyc
9430
0644
edit
dl
rm
markupbase.pyo
9236
0644
edit
dl
rm
md5.py
410
0644
edit
dl
rm
md5.pyc
376
0644
edit
dl
rm
md5.pyo
376
0644
edit
dl
rm
mhlib.py
33434
0644
edit
dl
rm
mhlib.pyc
33981
0644
edit
dl
rm
mhlib.pyo
33981
0644
edit
dl
rm
mimetools.py
7168
0644
edit
dl
rm
mimetools.pyc
8280
0644
edit
dl
rm
mimetools.pyo
8280
0644
edit
dl
rm
mimetypes.py
18822
0644
edit
dl
rm
mimetypes.pyc
16838
0644
edit
dl
rm
mimetypes.pyo
16838
0644
edit
dl
rm
MimeWriter.py
6482
0644
edit
dl
rm
MimeWriter.pyc
7365
0644
edit
dl
rm
MimeWriter.pyo
7365
0644
edit
dl
rm
mimify.py
15024
0755
edit
dl
rm
mimify.pyc
12189
0644
edit
dl
rm
mimify.pyo
12189
0644
edit
dl
rm
modulefinder.py
24283
0644
edit
dl
rm
modulefinder.pyc
18939
0644
edit
dl
rm
modulefinder.pyo
18851
0644
edit
dl
rm
multifile.py
4820
0644
edit
dl
rm
multifile.pyc
5449
0644
edit
dl
rm
multifile.pyo
5405
0644
edit
dl
rm
mutex.py
1866
0644
edit
dl
rm
mutex.pyc
2512
0644
edit
dl
rm
mutex.pyo
2512
0644
edit
dl
rm
netrc.py
4111
0644
edit
dl
rm
netrc.pyc
3586
0644
edit
dl
rm
netrc.pyo
3586
0644
edit
dl
rm
new.py
706
0644
edit
dl
rm
new.pyc
908
0644
edit
dl
rm
new.pyo
908
0644
edit
dl
rm
nntplib.py
21470
0644
edit
dl
rm
nntplib.pyc
21091
0644
edit
dl
rm
nntplib.pyo
21091
0644
edit
dl
rm
ntpath.py
17752
0644
edit
dl
rm
ntpath.pyc
11582
0644
edit
dl
rm
ntpath.pyo
11535
0644
edit
dl
rm
nturl2path.py
2239
0644
edit
dl
rm
nturl2path.pyc
1771
0644
edit
dl
rm
nturl2path.pyo
1771
0644
edit
dl
rm
numbers.py
10271
0644
edit
dl
rm
numbers.pyc
13840
0644
edit
dl
rm
numbers.pyo
13840
0644
edit
dl
rm
opcode.py
5248
0644
edit
dl
rm
opcode.pyc
5907
0644
edit
dl
rm
opcode.pyo
5907
0644
edit
dl
rm
optparse.py
60849
0644
edit
dl
rm
optparse.pyc
53959
0644
edit
dl
rm
optparse.pyo
53877
0644
edit
dl
rm
ordereddict.py
36
0644
edit
dl
rm
ordereddict.pyc
183
0644
edit
dl
rm
ordereddict.pyo
183
0644
edit
dl
rm
os.py
25802
0644
edit
dl
rm
os.pyc
25702
0644
edit
dl
rm
os.pyo
25702
0644
edit
dl
rm
os2emxpath.py
4603
0644
edit
dl
rm
os2emxpath.pyc
4518
0644
edit
dl
rm
os2emxpath.pyo
4518
0644
edit
dl
rm
pdb.doc
7899
0644
edit
dl
rm
pdb.py
45333
0755
edit
dl
rm
pdb.pyc
43585
0644
edit
dl
rm
pdb.pyo
43585
0644
edit
dl
rm
pickle.py
44811
0644
edit
dl
rm
pickle.pyc
38437
0644
edit
dl
rm
pickle.pyo
38232
0644
edit
dl
rm
pickletools.py
74348
0644
edit
dl
rm
pickletools.pyc
57079
0644
edit
dl
rm
pickletools.pyo
56182
0644
edit
dl
rm
pipes.py
9647
0644
edit
dl
rm
pipes.pyc
9428
0644
edit
dl
rm
pipes.pyo
9428
0644
edit
dl
rm
pkgutil.py
20001
0644
edit
dl
rm
pkgutil.pyc
18954
0644
edit
dl
rm
pkgutil.pyo
18954
0644
edit
dl
rm
platform.py
52630
0755
edit
dl
rm
platform.pyc
38699
0644
edit
dl
rm
platform.pyo
38699
0644
edit
dl
rm
plistlib.py
15806
0644
edit
dl
rm
plistlib.pyc
19926
0644
edit
dl
rm
plistlib.pyo
19836
0644
edit
dl
rm
popen2.py
8416
0644
edit
dl
rm
popen2.pyc
9032
0644
edit
dl
rm
popen2.pyo
8988
0644
edit
dl
rm
poplib.py
12825
0644
edit
dl
rm
poplib.pyc
13352
0644
edit
dl
rm
poplib.pyo
13352
0644
edit
dl
rm
posixfile.py
8003
0644
edit
dl
rm
posixfile.pyc
7700
0644
edit
dl
rm
posixfile.pyo
7700
0644
edit
dl
rm
posixpath.py
13119
0644
edit
dl
rm
posixpath.pyc
11142
0644
edit
dl
rm
posixpath.pyo
11142
0644
edit
dl
rm
pprint.py
11932
0644
edit
dl
rm
pprint.pyc
10356
0644
edit
dl
rm
pprint.pyo
10181
0644
edit
dl
rm
profile.py
23510
0755
edit
dl
rm
profile.pyc
16600
0644
edit
dl
rm
profile.pyo
16355
0644
edit
dl
rm
pstats.py
27310
0644
edit
dl
rm
pstats.pyc
25212
0644
edit
dl
rm
pstats.pyo
25212
0644
edit
dl
rm
pty.py
4869
0644
edit
dl
rm
pty.pyc
4899
0644
edit
dl
rm
pty.pyo
4899
0644
edit
dl
rm
pyclbr.py
13282
0644
edit
dl
rm
pyclbr.pyc
9706
0644
edit
dl
rm
pyclbr.pyo
9706
0644
edit
dl
rm
pydoc.py
92432
0755
edit
dl
rm
pydoc.pyc
90662
0644
edit
dl
rm
pydoc.pyo
90594
0644
edit
dl
rm
pydoc_topics.py
423126
0644
edit
dl
rm
pydoc_topics.pyc
407586
0644
edit
dl
rm
pydoc_topics.pyo
407586
0644
edit
dl
rm
py_compile.py
5633
0644
edit
dl
rm
py_compile.pyc
6536
0644
edit
dl
rm
py_compile.pyo
6536
0644
edit
dl
rm
Queue.py
8574
0644
edit
dl
rm
Queue.pyc
9391
0644
edit
dl
rm
Queue.pyo
9391
0644
edit
dl
rm
quopri.py
6972
0755
edit
dl
rm
quopri.pyc
6666
0644
edit
dl
rm
quopri.pyo
6666
0644
edit
dl
rm
random.py
31966
0644
edit
dl
rm
random.pyc
25024
0644
edit
dl
rm
random.pyo
25024
0644
edit
dl
rm
re.py
12966
0644
edit
dl
rm
re.pyc
13122
0644
edit
dl
rm
re.pyo
13122
0644
edit
dl
rm
repr.py
4296
0644
edit
dl
rm
repr.pyc
5400
0644
edit
dl
rm
repr.pyo
5400
0644
edit
dl
rm
rexec.py
20152
0644
edit
dl
rm
rexec.pyc
24102
0644
edit
dl
rm
rexec.pyo
24102
0644
edit
dl
rm
rfc822.py
33295
0644
edit
dl
rm
rfc822.pyc
31990
0644
edit
dl
rm
rfc822.pyo
31990
0644
edit
dl
rm
rlcompleter.py
5866
0644
edit
dl
rm
rlcompleter.pyc
6057
0644
edit
dl
rm
rlcompleter.pyo
6057
0644
edit
dl
rm
robotparser.py
7014
0644
edit
dl
rm
robotparser.pyc
7804
0644
edit
dl
rm
robotparser.pyo
7804
0644
edit
dl
rm
runpy.py
5413
0644
edit
dl
rm
runpy.pyc
3965
0644
edit
dl
rm
runpy.pyo
3965
0644
edit
dl
rm
sched.py
5091
0644
edit
dl
rm
sched.pyc
4987
0644
edit
dl
rm
sched.pyo
4987
0644
edit
dl
rm
sets.py
19050
0644
edit
dl
rm
sets.pyc
16885
0644
edit
dl
rm
sets.pyo
16885
0644
edit
dl
rm
sgmllib.py
17884
0644
edit
dl
rm
sgmllib.pyc
15504
0644
edit
dl
rm
sgmllib.pyo
15504
0644
edit
dl
rm
sha.py
445
0644
edit
dl
rm
sha.pyc
419
0644
edit
dl
rm
sha.pyo
419
0644
edit
dl
rm
shelve.py
8078
0644
edit
dl
rm
shelve.pyc
10242
0644
edit
dl
rm
shelve.pyo
10242
0644
edit
dl
rm
shlex.py
11137
0644
edit
dl
rm
shlex.pyc
7684
0644
edit
dl
rm
shlex.pyo
7684
0644
edit
dl
rm
shutil.py
8632
0644
edit
dl
rm
shutil.pyc
9519
0644
edit
dl
rm
shutil.pyo
9519
0644
edit
dl
rm
SimpleHTTPServer.py
7422
0644
edit
dl
rm
SimpleHTTPServer.pyc
7744
0644
edit
dl
rm
SimpleHTTPServer.pyo
7744
0644
edit
dl
rm
SimpleXMLRPCServer.py
21992
0644
edit
dl
rm
SimpleXMLRPCServer.pyc
19575
0644
edit
dl
rm
SimpleXMLRPCServer.pyo
19575
0644
edit
dl
rm
site.py
18927
0644
edit
dl
rm
site.pyc
18663
0644
edit
dl
rm
site.pyo
18663
0644
edit
dl
rm
smtpd.py
18920
0755
edit
dl
rm
smtpd.pyc
16126
0644
edit
dl
rm
smtpd.pyo
16126
0644
edit
dl
rm
smtplib.py
30924
0755
edit
dl
rm
smtplib.pyc
29629
0644
edit
dl
rm
smtplib.pyo
29629
0644
edit
dl
rm
sndhdr.py
5973
0644
edit
dl
rm
sndhdr.pyc
7386
0644
edit
dl
rm
sndhdr.pyo
7386
0644
edit
dl
rm
socket.py
20149
0644
edit
dl
rm
socket.pyc
16067
0644
edit
dl
rm
socket.pyo
15982
0644
edit
dl
rm
SocketServer.py
22326
0644
edit
dl
rm
SocketServer.pyc
23035
0644
edit
dl
rm
SocketServer.pyo
23035
0644
edit
dl
rm
sre.py
384
0644
edit
dl
rm
sre.pyc
517
0644
edit
dl
rm
sre.pyo
517
0644
edit
dl
rm
sre_compile.py
16507
0644
edit
dl
rm
sre_compile.pyc
11455
0644
edit
dl
rm
sre_compile.pyo
11342
0644
edit
dl
rm
sre_constants.py
7137
0644
edit
dl
rm
sre_constants.pyc
6083
0644
edit
dl
rm
sre_constants.pyo
6083
0644
edit
dl
rm
sre_parse.py
26878
0644
edit
dl
rm
sre_parse.pyc
19622
0644
edit
dl
rm
sre_parse.pyo
19622
0644
edit
dl
rm
ssl.py
16677
0644
edit
dl
rm
ssl.pyc
14218
0644
edit
dl
rm
ssl.pyo
14218
0644
edit
dl
rm
stat.py
1718
0644
edit
dl
rm
stat.pyc
2683
0644
edit
dl
rm
stat.pyo
2683
0644
edit
dl
rm
statvfs.py
898
0644
edit
dl
rm
statvfs.pyc
618
0644
edit
dl
rm
statvfs.pyo
618
0644
edit
dl
rm
string.py
20745
0644
edit
dl
rm
string.pyc
19964
0644
edit
dl
rm
string.pyo
19964
0644
edit
dl
rm
StringIO.py
10621
0644
edit
dl
rm
StringIO.pyc
11494
0644
edit
dl
rm
StringIO.pyo
11494
0644
edit
dl
rm
stringold.py
12449
0644
edit
dl
rm
stringold.pyc
12539
0644
edit
dl
rm
stringold.pyo
12539
0644
edit
dl
rm
stringprep.py
13522
0644
edit
dl
rm
stringprep.pyc
14486
0644
edit
dl
rm
stringprep.pyo
14412
0644
edit
dl
rm
struct.py
82
0644
edit
dl
rm
struct.pyc
237
0644
edit
dl
rm
struct.pyo
237
0644
edit
dl
rm
subprocess.py
57945
0644
edit
dl
rm
subprocess.pyc
40975
0644
edit
dl
rm
subprocess.pyo
40918
0644
edit
dl
rm
sunau.py
16537
0644
edit
dl
rm
sunau.pyc
17976
0644
edit
dl
rm
sunau.pyo
17976
0644
edit
dl
rm
sunaudio.py
1399
0644
edit
dl
rm
sunaudio.pyc
1987
0644
edit
dl
rm
sunaudio.pyo
1987
0644
edit
dl
rm
symbol.py
2050
0755
edit
dl
rm
symbol.pyc
3021
0644
edit
dl
rm
symbol.pyo
3021
0644
edit
dl
rm
symtable.py
7911
0644
edit
dl
rm
symtable.pyc
12503
0644
edit
dl
rm
symtable.pyo
12373
0644
edit
dl
rm
tabnanny.py
11339
0755
edit
dl
rm
tabnanny.pyc
8293
0644
edit
dl
rm
tabnanny.pyo
8293
0644
edit
dl
rm
tarfile.py
87786
0644
edit
dl
rm
tarfile.pyc
73596
0644
edit
dl
rm
tarfile.pyo
73596
0644
edit
dl
rm
telnetlib.py
21808
0644
edit
dl
rm
telnetlib.pyc
19855
0644
edit
dl
rm
telnetlib.pyo
19855
0644
edit
dl
rm
tempfile.py
17774
0644
edit
dl
rm
tempfile.pyc
19463
0644
edit
dl
rm
tempfile.pyo
19463
0644
edit
dl
rm
textwrap.py
16889
0644
edit
dl
rm
textwrap.pyc
11766
0644
edit
dl
rm
textwrap.pyo
11674
0644
edit
dl
rm
this.py
1002
0644
edit
dl
rm
this.pyc
1239
0644
edit
dl
rm
this.pyo
1239
0644
edit
dl
rm
threading.py
31808
0644
edit
dl
rm
threading.pyc
27956
0644
edit
dl
rm
threading.pyo
25884
0644
edit
dl
rm
timeit.py
12003
0644
edit
dl
rm
timeit.pyc
11801
0644
edit
dl
rm
timeit.pyo
11801
0644
edit
dl
rm
toaiff.py
3142
0644
edit
dl
rm
toaiff.pyc
3126
0644
edit
dl
rm
toaiff.pyo
3126
0644
edit
dl
rm
token.py
2947
0755
edit
dl
rm
token.pyc
3830
0644
edit
dl
rm
token.pyo
3830
0644
edit
dl
rm
tokenize.py
16326
0644
edit
dl
rm
tokenize.pyc
13986
0644
edit
dl
rm
tokenize.pyo
13893
0644
edit
dl
rm
trace.py
30325
0644
edit
dl
rm
trace.pyc
22989
0644
edit
dl
rm
trace.pyo
22927
0644
edit
dl
rm
traceback.py
11211
0644
edit
dl
rm
traceback.pyc
11637
0644
edit
dl
rm
traceback.pyo
11637
0644
edit
dl
rm
tty.py
879
0644
edit
dl
rm
tty.pyc
1311
0644
edit
dl
rm
tty.pyo
1311
0644
edit
dl
rm
types.py
2323
0644
edit
dl
rm
types.pyc
2608
0644
edit
dl
rm
types.pyo
2608
0644
edit
dl
rm
unittest.py
31157
0644
edit
dl
rm
unittest.pyc
34656
0644
edit
dl
rm
unittest.pyo
34656
0644
edit
dl
rm
urllib.py
59022
0644
edit
dl
rm
urllib.pyc
51142
0644
edit
dl
rm
urllib.pyo
51048
0644
edit
dl
rm
urllib2.py
50866
0644
edit
dl
rm
urllib2.pyc
45569
0644
edit
dl
rm
urllib2.pyo
45475
0644
edit
dl
rm
urlparse.py
15618
0644
edit
dl
rm
urlparse.pyc
14727
0644
edit
dl
rm
urlparse.pyo
14727
0644
edit
dl
rm
user.py
1627
0644
edit
dl
rm
user.pyc
1734
0644
edit
dl
rm
user.pyo
1734
0644
edit
dl
rm
UserDict.py
5778
0644
edit
dl
rm
UserDict.pyc
8802
0644
edit
dl
rm
UserDict.pyo
8802
0644
edit
dl
rm
UserList.py
3644
0644
edit
dl
rm
UserList.pyc
6535
0644
edit
dl
rm
UserList.pyo
6535
0644
edit
dl
rm
UserString.py
9691
0755
edit
dl
rm
UserString.pyc
14786
0644
edit
dl
rm
UserString.pyo
14786
0644
edit
dl
rm
uu.py
5942
0755
edit
dl
rm
uu.pyc
4227
0644
edit
dl
rm
uu.pyo
4227
0644
edit
dl
rm
uuid.py
20944
0644
edit
dl
rm
uuid.pyc
21205
0644
edit
dl
rm
uuid.pyo
21205
0644
edit
dl
rm
warnings.py
14172
0644
edit
dl
rm
warnings.pyc
12996
0644
edit
dl
rm
warnings.pyo
12159
0644
edit
dl
rm
wave.py
17952
0644
edit
dl
rm
wave.pyc
19336
0644
edit
dl
rm
wave.pyo
19336
0644
edit
dl
rm
weakref.py
10087
0644
edit
dl
rm
weakref.pyc
13277
0644
edit
dl
rm
weakref.pyo
13277
0644
edit
dl
rm
webbrowser.py
21073
0644
edit
dl
rm
webbrowser.pyc
18669
0644
edit
dl
rm
webbrowser.pyo
18622
0644
edit
dl
rm
whichdb.py
3353
0644
edit
dl
rm
whichdb.pyc
2243
0644
edit
dl
rm
whichdb.pyo
2243
0644
edit
dl
rm
xdrlib.py
5513
0644
edit
dl
rm
xdrlib.pyc
9079
0644
edit
dl
rm
xdrlib.pyo
9079
0644
edit
dl
rm
xmllib.py
34865
0644
edit
dl
rm
xmllib.pyc
27166
0644
edit
dl
rm
xmllib.pyo
27166
0644
edit
dl
rm
xmlrpclib.py
47775
0644
edit
dl
rm
xmlrpclib.pyc
41230
0644
edit
dl
rm
xmlrpclib.pyo
41047
0644
edit
dl
rm
zipfile.py
53092
0644
edit
dl
rm
zipfile.pyc
37547
0644
edit
dl
rm
zipfile.pyo
37547
0644
edit
dl
rm
_abcoll.py
14242
0644
edit
dl
rm
_abcoll.pyc
21395
0644
edit
dl
rm
_abcoll.pyo
21395
0644
edit
dl
rm
_LWPCookieJar.py
6553
0644
edit
dl
rm
_LWPCookieJar.pyc
5589
0644
edit
dl
rm
_LWPCookieJar.pyo
5589
0644
edit
dl
rm
_MozillaCookieJar.py
5809
0644
edit
dl
rm
_MozillaCookieJar.pyc
4509
0644
edit
dl
rm
_MozillaCookieJar.pyo
4468
0644
edit
dl
rm
_strptime.py
19754
0644
edit
dl
rm
_strptime.pyc
14926
0644
edit
dl
rm
_strptime.pyo
14926
0644
edit
dl
rm
_threading_local.py
7114
0644
edit
dl
rm
_threading_local.pyc
6367
0644
edit
dl
rm
_threading_local.pyo
6367
0644
edit
dl
rm
__future__.py
4380
0644
edit
dl
rm
__future__.pyc
4221
0644
edit
dl
rm
__future__.pyo
4221
0644
edit
dl
rm
__phello__.foo.py
64
0644
edit
dl
rm
__phello__.foo.pyc
123
0644
edit
dl
rm
__phello__.foo.pyo
123
0644
edit
dl
rm
Edit:
/usr/lib/python2.6/cgi.py
(34478B)
#! /usr/bin/env python2.6 # NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is # intentionally NOT "/usr/bin/env python". On many systems # (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI # scripts, and /usr/local/bin is the default directory where Python is # installed, so /usr/bin/env would be unable to find python. Granted, # binary installations by Linux vendors often install Python in # /usr/bin. So let those vendors patch cgi.py to match their choice # of installation. """Support module for CGI (Common Gateway Interface) scripts. This module defines a number of utilities for use by CGI scripts written in Python. """ # XXX Perhaps there should be a slimmed version that doesn't contain # all those backwards compatible and debugging classes and functions? # History # ------- # # Michael McLay started this module. Steve Majewski changed the # interface to SvFormContentDict and FormContentDict. The multipart # parsing was inspired by code submitted by Andreas Paepcke. Guido van # Rossum rewrote, reformatted and documented the module and is currently # responsible for its maintenance. # __version__ = "2.6" # Imports # ======= from operator import attrgetter import sys import os import urllib import UserDict import urlparse from warnings import filterwarnings, catch_warnings, warn with catch_warnings(): if sys.py3kwarning: filterwarnings("ignore", ".*mimetools has been removed", DeprecationWarning) import mimetools if sys.py3kwarning: filterwarnings("ignore", ".*rfc822 has been removed", DeprecationWarning) import rfc822 try: from cStringIO import StringIO except ImportError: from StringIO import StringIO __all__ = ["MiniFieldStorage", "FieldStorage", "FormContentDict", "SvFormContentDict", "InterpFormContentDict", "FormContent", "parse", "parse_qs", "parse_qsl", "parse_multipart", "parse_header", "print_exception", "print_environ", "print_form", "print_directory", "print_arguments", "print_environ_usage", "escape"] # Logging support # =============== logfile = "" # Filename to log to, if not empty logfp = None # File object to log to, if not None def 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). """ global logfp, log if logfile and not logfp: try: logfp = open(logfile, "a") except IOError: pass if not logfp: log = nolog else: log = dolog log(*allargs) def dolog(fmt, *args): """Write a log message to the log file. See initlog() for docs.""" logfp.write(fmt%args + "\n") def nolog(*allargs): """Dummy function, assigned to log when logging is disabled.""" pass log = initlog # The current logging function # Parsing functions # ================= # Maximum input we will accept when REQUEST_METHOD is POST # 0 ==> unlimited input maxlen = 0 def 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. """ if fp is None: fp = sys.stdin if not 'REQUEST_METHOD' in environ: environ['REQUEST_METHOD'] = 'GET' # For testing stand-alone if environ['REQUEST_METHOD'] == 'POST': ctype, pdict = parse_header(environ['CONTENT_TYPE']) if ctype == 'multipart/form-data': return parse_multipart(fp, pdict) elif ctype == 'application/x-www-form-urlencoded': clength = int(environ['CONTENT_LENGTH']) if maxlen and clength > maxlen: raise ValueError, 'Maximum content length exceeded' qs = fp.read(clength) else: qs = '' # Unknown content-type if 'QUERY_STRING' in environ: if qs: qs = qs + '&' qs = qs + environ['QUERY_STRING'] elif sys.argv[1:]: if qs: qs = qs + '&' qs = qs + sys.argv[1] environ['QUERY_STRING'] = qs # XXX Shouldn't, really elif 'QUERY_STRING' in environ: qs = environ['QUERY_STRING'] else: if sys.argv[1:]: qs = sys.argv[1] else: qs = "" environ['QUERY_STRING'] = qs # XXX Shouldn't, really return urlparse.parse_qs(qs, keep_blank_values, strict_parsing) # parse query string function called from urlparse, # this is done in order to maintain backward compatiblity. def parse_qs(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument.""" warn("cgi.parse_qs is deprecated, use urlparse.parse_qs \ instead", PendingDeprecationWarning, 2) return urlparse.parse_qs(qs, keep_blank_values, strict_parsing) def parse_qsl(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument.""" warn("cgi.parse_qsl is deprecated, use urlparse.parse_qsl instead", PendingDeprecationWarning, 2) return urlparse.parse_qsl(qs, keep_blank_values, strict_parsing) def parse_multipart(fp, pdict): """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(). """ boundary = "" if 'boundary' in pdict: boundary = pdict['boundary'] if not valid_boundary(boundary): raise ValueError, ('Invalid boundary in multipart form: %r' % (boundary,)) nextpart = "--" + boundary lastpart = "--" + boundary + "--" partdict = {} terminator = "" while terminator != lastpart: bytes = -1 data = None if terminator: # At start of next part. Read headers first. headers = mimetools.Message(fp) clength = headers.getheader('content-length') if clength: try: bytes = int(clength) except ValueError: pass if bytes > 0: if maxlen and bytes > maxlen: raise ValueError, 'Maximum content length exceeded' data = fp.read(bytes) else: data = "" # Read lines until end of part. lines = [] while 1: line = fp.readline() if not line: terminator = lastpart # End outer loop break if line[:2] == "--": terminator = line.strip() if terminator in (nextpart, lastpart): break lines.append(line) # Done with part. if data is None: continue if bytes < 0: if lines: # Strip final line terminator line = lines[-1] if line[-2:] == "\r\n": line = line[:-2] elif line[-1:] == "\n": line = line[:-1] lines[-1] = line data = "".join(lines) line = headers['content-disposition'] if not line: continue key, params = parse_header(line) if key != 'form-data': continue if 'name' in params: name = params['name'] else: continue if name in partdict: partdict[name].append(data) else: partdict[name] = [data] return partdict def _parseparam(s): while s[:1] == ';': s = s[1:] end = s.find(';') while end > 0 and s.count('"', 0, end) % 2: end = s.find(';', end + 1) if end < 0: end = len(s) f = s[:end] yield f.strip() s = s[end:] def parse_header(line): """Parse a Content-type like header. Return the main content-type and a dictionary of options. """ parts = _parseparam(';' + line) key = parts.next() pdict = {} for p in parts: i = p.find('=') if i >= 0: name = p[:i].strip().lower() value = p[i+1:].strip() if len(value) >= 2 and value[0] == value[-1] == '"': value = value[1:-1] value = value.replace('\\\\', '\\').replace('\\"', '"') pdict[name] = value return key, pdict # Classes for field storage # ========================= class MiniFieldStorage: """Like FieldStorage, for use when no file uploads are possible.""" # Dummy attributes filename = None list = None type = None file = None type_options = {} disposition = None disposition_options = {} headers = {} def __init__(self, name, value): """Constructor from field name and value.""" self.name = name self.value = value # self.file = StringIO(value) def __repr__(self): """Return printable representation.""" return "MiniFieldStorage(%r, %r)" % (self.name, self.value) class FieldStorage: """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. """ def __init__(self, fp=None, headers=None, outerboundary="", environ=os.environ, keep_blank_values=0, strict_parsing=0): """Constructor. 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. """ method = 'GET' self.keep_blank_values = keep_blank_values self.strict_parsing = strict_parsing if 'REQUEST_METHOD' in environ: method = environ['REQUEST_METHOD'].upper() self.qs_on_post = None if method == 'GET' or method == 'HEAD': if 'QUERY_STRING' in environ: qs = environ['QUERY_STRING'] elif sys.argv[1:]: qs = sys.argv[1] else: qs = "" fp = StringIO(qs) if headers is None: headers = {'content-type': "application/x-www-form-urlencoded"} if headers is None: headers = {} if method == 'POST': # Set default content-type for POST to what's traditional headers['content-type'] = "application/x-www-form-urlencoded" if 'CONTENT_TYPE' in environ: headers['content-type'] = environ['CONTENT_TYPE'] if 'QUERY_STRING' in environ: self.qs_on_post = environ['QUERY_STRING'] if 'CONTENT_LENGTH' in environ: headers['content-length'] = environ['CONTENT_LENGTH'] self.fp = fp or sys.stdin self.headers = headers self.outerboundary = outerboundary # Process content-disposition header cdisp, pdict = "", {} if 'content-disposition' in self.headers: cdisp, pdict = parse_header(self.headers['content-disposition']) self.disposition = cdisp self.disposition_options = pdict self.name = None if 'name' in pdict: self.name = pdict['name'] self.filename = None if 'filename' in pdict: self.filename = pdict['filename'] # Process content-type header # # Honor any existing content-type header. But if there is no # content-type header, use some sensible defaults. Assume # outerboundary is "" at the outer level, but something non-false # inside a multi-part. The default for an inner part is text/plain, # but for an outer part it should be urlencoded. This should catch # bogus clients which erroneously forget to include a content-type # header. # # See below for what we do if there does exist a content-type header, # but it happens to be something we don't understand. if 'content-type' in self.headers: ctype, pdict = parse_header(self.headers['content-type']) elif self.outerboundary or method != 'POST': ctype, pdict = "text/plain", {} else: ctype, pdict = 'application/x-www-form-urlencoded', {} self.type = ctype self.type_options = pdict self.innerboundary = "" if 'boundary' in pdict: self.innerboundary = pdict['boundary'] clen = -1 if 'content-length' in self.headers: try: clen = int(self.headers['content-length']) except ValueError: pass if maxlen and clen > maxlen: raise ValueError, 'Maximum content length exceeded' self.length = clen self.list = self.file = None self.done = 0 if ctype == 'application/x-www-form-urlencoded': self.read_urlencoded() elif ctype[:10] == 'multipart/': self.read_multi(environ, keep_blank_values, strict_parsing) else: self.read_single() def __repr__(self): """Return a printable representation.""" return "FieldStorage(%r, %r, %r)" % ( self.name, self.filename, self.value) def __iter__(self): return iter(self.keys()) def __getattr__(self, name): if name != 'value': raise AttributeError, name if self.file: self.file.seek(0) value = self.file.read() self.file.seek(0) elif self.list is not None: value = self.list else: value = None return value def __getitem__(self, key): """Dictionary style indexing.""" if self.list is None: raise TypeError, "not indexable" found = [] for item in self.list: if item.name == key: found.append(item) if not found: raise KeyError, key if len(found) == 1: return found[0] else: return found def getvalue(self, key, default=None): """Dictionary style get() method, including 'value' lookup.""" if key in self: value = self[key] if type(value) is type([]): return map(attrgetter('value'), value) else: return value.value else: return default def getfirst(self, key, default=None): """ Return the first value received.""" if key in self: value = self[key] if type(value) is type([]): return value[0].value else: return value.value else: return default def getlist(self, key): """ Return list of received values.""" if key in self: value = self[key] if type(value) is type([]): return map(attrgetter('value'), value) else: return [value.value] else: return [] def keys(self): """Dictionary style keys() method.""" if self.list is None: raise TypeError, "not indexable" return list(set(item.name for item in self.list)) def has_key(self, key): """Dictionary style has_key() method.""" if self.list is None: raise TypeError, "not indexable" return any(item.name == key for item in self.list) def __contains__(self, key): """Dictionary style __contains__ method.""" if self.list is None: raise TypeError, "not indexable" return any(item.name == key for item in self.list) def __len__(self): """Dictionary style len(x) support.""" return len(self.keys()) def __nonzero__(self): return bool(self.list) def read_urlencoded(self): """Internal: read data in query string format.""" qs = self.fp.read(self.length) if self.qs_on_post: qs += '&' + self.qs_on_post self.list = list = [] for key, value in urlparse.parse_qsl(qs, self.keep_blank_values, self.strict_parsing): list.append(MiniFieldStorage(key, value)) self.skip_lines() FieldStorageClass = None def read_multi(self, environ, keep_blank_values, strict_parsing): """Internal: read a part that is itself multipart.""" ib = self.innerboundary if not valid_boundary(ib): raise ValueError, 'Invalid boundary in multipart form: %r' % (ib,) self.list = [] if self.qs_on_post: for key, value in urlparse.parse_qsl(self.qs_on_post, self.keep_blank_values, self.strict_parsing): self.list.append(MiniFieldStorage(key, value)) FieldStorageClass = None klass = self.FieldStorageClass or self.__class__ part = klass(self.fp, {}, ib, environ, keep_blank_values, strict_parsing) # Throw first part away while not part.done: headers = rfc822.Message(self.fp) part = klass(self.fp, headers, ib, environ, keep_blank_values, strict_parsing) self.list.append(part) self.skip_lines() def read_single(self): """Internal: read an atomic part.""" if self.length >= 0: self.read_binary() self.skip_lines() else: self.read_lines() self.file.seek(0) bufsize = 8*1024 # I/O buffering size for copy to file def read_binary(self): """Internal: read binary data.""" self.file = self.make_file('b') todo = self.length if todo >= 0: while todo > 0: data = self.fp.read(min(todo, self.bufsize)) if not data: self.done = -1 break self.file.write(data) todo = todo - len(data) def read_lines(self): """Internal: read lines until EOF or outerboundary.""" self.file = self.__file = StringIO() if self.outerboundary: self.read_lines_to_outerboundary() else: self.read_lines_to_eof() def __write(self, line): if self.__file is not None: if self.__file.tell() + len(line) > 1000: self.file = self.make_file('') self.file.write(self.__file.getvalue()) self.__file = None self.file.write(line) def read_lines_to_eof(self): """Internal: read lines until EOF.""" while 1: line = self.fp.readline(1<<16) if not line: self.done = -1 break self.__write(line) def read_lines_to_outerboundary(self): """Internal: read lines until outerboundary.""" next = "--" + self.outerboundary last = next + "--" delim = "" last_line_lfend = True while 1: line = self.fp.readline(1<<16) if not line: self.done = -1 break if line[:2] == "--" and last_line_lfend: strippedline = line.strip() if strippedline == next: break if strippedline == last: self.done = 1 break odelim = delim if line[-2:] == "\r\n": delim = "\r\n" line = line[:-2] last_line_lfend = True elif line[-1] == "\n": delim = "\n" line = line[:-1] last_line_lfend = True else: delim = "" last_line_lfend = False self.__write(odelim + line) def skip_lines(self): """Internal: skip lines until outer boundary if defined.""" if not self.outerboundary or self.done: return next = "--" + self.outerboundary last = next + "--" last_line_lfend = True while 1: line = self.fp.readline(1<<16) if not line: self.done = -1 break if line[:2] == "--" and last_line_lfend: strippedline = line.strip() if strippedline == next: break if strippedline == last: self.done = 1 break last_line_lfend = line.endswith('\n') def 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. """ import tempfile return tempfile.TemporaryFile("w+b") # Backwards Compatibility Classes # =============================== class FormContentDict(UserDict.UserDict): """Form 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, ...], ...} """ def __init__(self, environ=os.environ, keep_blank_values=0, strict_parsing=0): self.dict = self.data = parse(environ=environ, keep_blank_values=keep_blank_values, strict_parsing=strict_parsing) self.query_string = environ['QUERY_STRING'] class SvFormContentDict(FormContentDict): """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. """ def __getitem__(self, key): if len(self.dict[key]) > 1: raise IndexError, 'expecting a single value' return self.dict[key][0] def getlist(self, key): return self.dict[key] def values(self): result = [] for value in self.dict.values(): if len(value) == 1: result.append(value[0]) else: result.append(value) return result def items(self): result = [] for key, value in self.dict.items(): if len(value) == 1: result.append((key, value[0])) else: result.append((key, value)) return result class InterpFormContentDict(SvFormContentDict): """This class is present for backwards compatibility only.""" def __getitem__(self, key): v = SvFormContentDict.__getitem__(self, key) if v[0] in '0123456789+-.': try: return int(v) except ValueError: try: return float(v) except ValueError: pass return v.strip() def values(self): result = [] for key in self.keys(): try: result.append(self[key]) except IndexError: result.append(self.dict[key]) return result def items(self): result = [] for key in self.keys(): try: result.append((key, self[key])) except IndexError: result.append((key, self.dict[key])) return result class FormContent(FormContentDict): """This class is present for backwards compatibility only.""" def values(self, key): if key in self.dict :return self.dict[key] else: return None def indexed_value(self, key, location): if key in self.dict: if len(self.dict[key]) > location: return self.dict[key][location] else: return None else: return None def value(self, key): if key in self.dict: return self.dict[key][0] else: return None def length(self, key): return len(self.dict[key]) def stripped(self, key): if key in self.dict: return self.dict[key][0].strip() else: return None def pars(self): return self.dict # Test/debug code # =============== def 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. """ print "Content-type: text/html" print sys.stderr = sys.stdout try: form = FieldStorage() # Replace with other classes to test those print_directory() print_arguments() print_form(form) print_environ(environ) print_environ_usage() def f(): exec "testing print_exception() -- <I>italics?</I>" def g(f=f): f() print "<H3>What follows is a test, not an actual exception:</H3>" g() except: print_exception() print "<H1>Second try with a small maxlen...</H1>" global maxlen maxlen = 50 try: form = FieldStorage() # Replace with other classes to test those print_directory() print_arguments() print_form(form) print_environ(environ) except: print_exception() def print_exception(type=None, value=None, tb=None, limit=None): if type is None: type, value, tb = sys.exc_info() import traceback print print "<H3>Traceback (most recent call last):</H3>" list = traceback.format_tb(tb, limit) + \ traceback.format_exception_only(type, value) print "<PRE>%s<B>%s</B></PRE>" % ( escape("".join(list[:-1])), escape(list[-1]), ) del tb def print_environ(environ=os.environ): """Dump the shell environment as HTML.""" keys = environ.keys() keys.sort() print print "<H3>Shell Environment:</H3>" print "<DL>" for key in keys: print "<DT>", escape(key), "<DD>", escape(environ[key]) print "</DL>" print def print_form(form): """Dump the contents of a form as HTML.""" keys = form.keys() keys.sort() print print "<H3>Form Contents:</H3>" if not keys: print "<P>No form fields." print "<DL>" for key in keys: print "<DT>" + escape(key) + ":", value = form[key] print "<i>" + escape(repr(type(value))) + "</i>" print "<DD>" + escape(repr(value)) print "</DL>" print def print_directory(): """Dump the current directory as HTML.""" print print "<H3>Current Working Directory:</H3>" try: pwd = os.getcwd() except os.error, msg: print "os.error:", escape(str(msg)) else: print escape(pwd) print def print_arguments(): print print "<H3>Command Line Arguments:</H3>" print print sys.argv print def print_environ_usage(): """Dump a list of environment variables used by CGI as HTML.""" print """ <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> """ # Utilities # ========= def escape(s, quote=None): '''Replace special characters "&", "<" and ">" to HTML-safe sequences. If the optional flag quote is true, the quotation mark character (") is also translated.''' s = s.replace("&", "&") # Must be done first! s = s.replace("<", "<") s = s.replace(">", ">") if quote: s = s.replace('"', """) return s def valid_boundary(s, _vb_pattern="^[ -~]{0,200}[!-~]$"): import re return re.match(_vb_pattern, s) # Invoke mainline # =============== # Call test() when this file is run as a script (not imported as a module) if __name__ == '__main__': test()
Save
cmd:
run