#!/usr/bin/env python3 import cgitb; cgitb.enable() import os import sys from cgi import escape as quote from . import config from . import teams from . import points flags_dir = config.get('global', 'flags_dir') house_team = config.get('global', 'house_team') def main(): s = points.Storage() categories = [(cat, s.cat_points(cat)) for cat in s.categories()] categories = [(c, p) for (c, p) in categories if p > 0] print('Refresh: 10') print(config.start_html('Scoreboard', cls='wide')) print('
Overall | ') for cat, score in categories: print('')
print(' %s (%d)' % (cat, score))
try:
fn = os.path.join(flags_dir, cat)
team = open(fn).read() or house_team
print(' ') print(' %s' % (cat, teams.color(team), quote(team[:15]))) except IOError: pass print(' | ')
print('
---|---|
| ')
for cat, total in categories:
print('') scores = sorted([(s.team_points_in_cat(cat, team), team) for team in s.teams]) for score, team in scores: if not score: continue color = teams.color(team) print(' | ') print(' ') print('
''') print(config.end_html()) if __name__ == '__main__': main() # Local Variables: # mode: python # End: