#! /usr/bin/env python3 import cgitb; cgitb.enable() import cgi import fcntl import string from . import teams from . import config def head(title): return '''
Pick a short team name: you'll be typing it a lot.
''' % config.url('register.cgi')) + config.end_html()) if not (team and pw and confirm_pw): # If we're starting from the beginning? html = html.substitute(team_error='', pw_match_error='') elif teams.exists(team): html = html.substitute(team_error='Team team already taken', pw_match_error='') elif pw != confirm_pw: html = html.substitute(team_error='', pw_match_error='Passwords do not match') else: teams.add(team, pw) html = (config.start_html('Team registered') + ('Congratulations, %s is now registered. Go back to the front page and start playing!
' % (team, config.url(''))) + config.end_html()) print(html) if __name__ == '__main__': main()