#!/usr/bin/env python3 import cgitb; cgitb.enable() import points print('Content-type: text/html') print() s = points.Storage('scores.dat') rows = 20 teams = s.teams() categories = [(cat, s.cat_points(cat)) for cat in s.categories()] teamcolors = points.colors(teams) print(''' yo mom

Scoreboard

''') print('') print('') for cat, points in categories: print('' % (cat, points)) print('') print('') for cat, total in categories: print('') print('') print('''
%s (%d)
') scores = sorted([(s.team_points_in_cat(cat, team), team) for team in teams]) for points, team in scores: color = teamcolors[team] print('
' % (float(points * 100)/total, color)) print(' %s: %d' % (cat, team, points)) print('
') print('
''')