-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexport_file.py
50 lines (39 loc) · 909 Bytes
/
export_file.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import sys
tmp=sys.argv[1]
a="""#!/usr/bin/env python
import cgi
import cgitb
import sys
import numpy
import os
import os.path
import MySQLdb
import string
import random
##################
TEMP="XXTEMP"
##################
cgitb.enable()
form = cgi.FieldStorage()
TYPE=form.getvalue("type")
PROJECT=form.getvalue("project")
try:
if(TYPE=="eigengenes"):
fid=TEMP+"/EIGENGENES_test.pdf"
elif(TYPE=="heatmap"):
fid=TEMP+"/EIGENGENES_test_hm.pdf"
elif(TYPE=="genegroup"):
fid=TEMP+"/EIGENGENES_test_bx.pdf"
elif(TYPE=="network"):
fid=TEMP+"/NETWORK.pdf"
elif(TYPE=="REPORT"):
fid=TEMP+"/"+PROJECT+"_comment_BOX.pdf"
print "Content-type: application/pdf\\n\\n"
with open(fid, "r") as f:
print f.read()
except Exception:
print "Content-type: text/html\\n"
print "Unfortunately, download did not work"
"""
a=a.replace("XXTEMP",tmp)
print a