def output():
response.headers['Access-Control-Allow-Origin'] = '*'
response.headers['Access-Control-Allow-Methods'] = 'PUT, GET, POST, DELETE, OPTIONS'
response.headers['Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token'
app = request.query.app
cid = request.query.cid
user = request.query.user
try:
if re.search("/", cid):
(u, c) = cid.split("/")
else:
u = user
c = cid
run_dir = os.path.join(user_dir, u, app, c)
fn = os.path.join(run_dir, app + '.out')
output = slurp_file(fn)
# the following line will convert HTML chars like > to entities >
# this is needed so that XML input files will show paramters labels
output = cgi.escape(output)
return output
# params = { 'cid': cid, 'contents': output, 'app': app,
# 'user': u, 'fn': fn, 'apps': myapps.keys() }
# return template('more', params)
except:
return "ERROR: something went wrong!"
# params = { 'app': app, 'apps': myapps.keys(),
# 'err': "Couldn't read input file. Check casename." }
# return template('error', params)
评论列表
文章目录