From: <ki...@us...> - 2003-04-08 20:52:07
|
Update of /cvsroot/pymerase/pymerase/pymweb/cgi In directory sc8-pr-cvs1:/tmp/cvs-serv28673/cgi Modified Files: pymweb.py Log Message: now creates an index.html in /tmp/pymweb to prevent people from seeing other peoples output files. Create an index.html in the session directory which is the same as the user sees after generating a file. This allows someone to go back to their session directory and access the files they have created. Index: pymweb.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/pymweb/cgi/pymweb.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pymweb.py 8 Apr 2003 20:27:29 -0000 1.5 --- pymweb.py 8 Apr 2003 20:51:58 -0000 1.6 *************** *** 90,93 **** --- 90,96 ---- if not os.path.exists(ROOTPATH): os.mkdir(ROOTPATH) + f = open(os.path.join(ROOTPATH, 'index.html'), 'w') + f.write("Pymweb") + f.close() tempfile.tempdir = ROOTPATH DIRPATH = tempfile.mktemp() *************** *** 128,136 **** if __name__ == '__main__': ! print "Content-Type: text/html" ! print "" - print "<img src=\"/images/pymerase-title.jpg\" alt=\"Pymerase\"><br>" - print "Version %s<br><br>" % (pymerase.VERSION) form = cgi.FieldStorage() --- 131,147 ---- if __name__ == '__main__': ! html = "" ! text = "Content-Type: text/html\n\n" ! print text ! #html += text ! ! text = "<img src=\"/images/pymerase-title.jpg\" alt=\"Pymerase\"><br>\n" ! print text ! html += text ! ! text = "Version %s<br><br>\n\n" % (pymerase.VERSION) ! print text ! html += text form = cgi.FieldStorage() *************** *** 150,160 **** #print 'File %s saved.<br><br>' % (saved) ! print '<b>Session:</b> %s<br>' % (myfile) ! print '<b>Input:</b> %s<br>' % (form['input'].value) ! print '<b>Output:</b> %s<br>' % (form['output'].value) ! print '<b>Schema:</b> %s<br>' % (fileName) ! print '<b>Destination:</b> %s<br>' % (form['dest'].value) ! print '<b>Compression:</b> %s<br>' % (form['compression'].value) ! print '<br>' driver = getDriverProgram(form['input'].value, --- 161,191 ---- #print 'File %s saved.<br><br>' % (saved) ! text = '<b>Session:</b> %s<br>\n' % (myfile) ! print text ! html += text ! ! text = '<b>Input:</b> %s<br>\n' % (form['input'].value) ! print text ! html += text ! ! text = '<b>Output:</b> %s<br>\n' % (form['output'].value) ! print text ! html += text ! ! text = '<b>Schema:</b> %s<br>\n' % (fileName) ! print text ! html += text ! ! text = '<b>Destination:</b> %s<br>\n' % (form['dest'].value) ! print text ! html += text ! ! text = '<b>Compression:</b> %s<br>\n' % (form['compression'].value) ! print text ! html += text ! ! text = '<br>\n' ! print text ! html += text driver = getDriverProgram(form['input'].value, *************** *** 182,198 **** if str(text) != '0': ! print 'ERROR, exit code %s<br>' % (text) ! print 'E-mail pymerase-devel at lists.sourceforge.net for help.<br>' else: ! print '<b>Generation Complete</b><br>' if form['compression'].value == 'Tar&Gzip': ! print 'Download: <a href="/pymweb/%s/%s.tar.gz">%s.tar.gz</a>' % (myfile, ! form['dest'].value, ! form['dest'].value) elif form['compression'].value == 'Zip': ! print 'Download: <a href="/pymweb/%s/%s.zip">%s.zip</a>' % (myfile, ! form['dest'].value, ! form['dest'].value) else: raise ValueError, '%s invalid compression type!' % (form['compression'].value) --- 213,242 ---- if str(text) != '0': ! text = 'ERROR, exit code %s<br>\n' % (text) ! print text ! html += text ! ! text = 'E-mail pymerase-devel at lists.sourceforge.net for help.<br>' ! print text ! html += text else: ! text = '<b>Generation Complete</b><br>' ! print text ! html += text if form['compression'].value == 'Tar&Gzip': ! text = 'Download: <a href="/pymweb/%s/%s.tar.gz">%s.tar.gz</a>' % \ ! (myfile, form['dest'].value, form['dest'].value) ! print text ! html += text ! elif form['compression'].value == 'Zip': ! text = 'Download: <a href="/pymweb/%s/%s.zip">%s.zip</a>' % \ ! (myfile, form['dest'].value, form['dest'].value) ! print text ! html += text else: raise ValueError, '%s invalid compression type!' % (form['compression'].value) + htmlFile = open(os.path.join(DIRPATH, 'index.html'), 'w') + htmlFile.write(html) + htmlFile.close() |