#! /usr/bin/python
import os
from ctf import html, paths
from cgi import escape
basedir = os.path.join(paths.VAR, 'tanks')
links = '''
Tanks
Docs
Results
Submit
My Errors
'''
body = []
body.append('Last Winner:
')
body.append('')
body.append(escape(open(os.path.join(basedir, 'winner')).read()))
body.append('
')
body.append('Results so far:
')
body.append('')
results = os.listdir(os.path.join(basedir, 'results'))
results.sort()
results.reverse()
for fn in results:
num, _ = os.path.splitext(fn)
body.append('- %s
' % (fn, num))
body.append('
')
html.serve('Tanks Results', '\n'.join(body), links=links)