-
Notifications
You must be signed in to change notification settings - Fork 1
/
root.py
executable file
·34 lines (31 loc) · 1.12 KB
/
root.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
#!/usr/bin/env python
from deck_mysql import DeckDB
from printers import HTMLOutput, TextOutput
import csv, sys, os, cgi, cgitb
from login import check_login
cgitb.enable()
output = HTMLOutput()
print """Content-type: text/html
<html>
<head><title>Deck Checks - root</title><link rel='stylesheet' href='style.css' /></head>
<body>
<h1>Deck Checks</h1>
"""
form = cgi.FieldStorage()
with DeckDB() as db:
db.checkEvent(form["event"].value, output)
roundnum = db.get_round(db.getEventId(form["event"].value))
output.pageHeader(db, form['event'].value, roundnum, form)
if check_login(output, form['event'].value, form['password'].value if 'password' in form else '', 'root'):
output.printLink(form, 'get_table', 'Lookup by table')
output.printLink(form, 'get_player', 'Lookup by player')
output.printLink(form, 'top_tables', 'Check top tables')
output.printLink(form, 'recommend', 'Recommend checks')
output.printLink(form, 'allchecks', 'See all checks')
output.printLink(form, 'pairings', 'Pairings')
output.printLink(form, 'import', 'Import data')
output.printLink(form, 'settings', 'Event settings')
print """
</body>
</html>
"""