From 4f3c7190d4945872ccdb45a5b579ec65d41070da Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Wed, 7 Oct 2009 10:38:30 -0600 Subject: [PATCH] Gussy up register.py --- ctf/register.py | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/ctf/register.py b/ctf/register.py index 422b798..b41a7f2 100755 --- a/ctf/register.py +++ b/ctf/register.py @@ -7,6 +7,22 @@ import string from . import teams from . import config +def head(title): + return ''' + + + + Team Registration + + + +

%s

+''' % (config.css, title) + +def foot(): + return '''''' + def main(): print('Content-type: text/html') print() @@ -17,17 +33,8 @@ def main(): pw = f.getfirst('pw') confirm_pw = f.getfirst('confirm_pw') - html = string.Template(''' - - - - Team Registration - - - -

Team Registration

- + html = string.Template(head('Team Registration') + + ('''

Pick a short team name: you'll be typing it a lot.

@@ -50,10 +57,8 @@ def main(): - - - - ''' % (config.css, config.url('register.cgi'))) + ''' % config.url('register.cgi')) + + foot()) if not (team and pw and confirm_pw): # If we're starting from the beginning? html = html.substitute(team_error='', @@ -66,7 +71,9 @@ def main(): pw_match_error='Passwords do not match') else: teams.add(team, pw) - html = 'Team registered.' + html = (head('Team registered') + + ('

Congratulations, %s is now registered. Go back to the front page and start playing!

' % (team, config.url(''))) + + foot()) print(html)