blob: 59723a9f7d07958712299f14837f0ba3316c08eb [file] [log] [blame]
mbligh38e9d782008-05-01 20:49:41 +00001#!/usr/bin/python
2
3import cgi, os, sys
4
5page = """\
showarda80823b2008-07-24 16:33:35 +00006Status: 302 Found
mblighe0869d02008-06-04 20:04:28 +00007Content-Type: text/plain
showard77f95db2008-07-17 16:59:38 +00008Location: %s\r\n\r
mbligh38e9d782008-05-01 20:49:41 +00009"""
10
11# Get access to directories
12tko = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0])))
13sys.path.insert(0, tko)
14
15autodir = os.path.abspath(os.path.join(tko, '..'))
16
17# Define function for retrieving logs
18try:
19 import site_retrieve_logs
20 retrieve_logs = site_retrieve_logs.retrieve_logs
21 del site_retrieve_logs
22except ImportError:
23 def retrieve_logs(autodir, job_path):
24 pass
25
26# Get form fields
27form = cgi.FieldStorage(keep_blank_values=True)
28# Retrieve logs
29job_path = form['job'].value[1:]
30keyval = retrieve_logs(autodir, job_path)
31
32# Redirect to results page
33testname = ''
34if 'test' in form:
35 testname = form['test'].value
mblighe0869d02008-06-04 20:04:28 +000036 full_path = os.path.join(autodir, job_path, form['test'].value)
37 if not os.path.exists(full_path):
38 testname = ''
mbligh38e9d782008-05-01 20:49:41 +000039path = "%s%s" % (form['job'].value, testname)
40print page % path