annotate web/recent.cgi @ 21:453278a81371

Add tablerecent() so recent.cgi will work as before. Port the tablerecent() function, which reads the most recent games directly from the logfile instead of the database. This allows recent.cgi to show games immediately without waiting for the recorder to put them in the database.
author John "Elwin" Edwards <elwin@sdf.org>
date Mon, 17 Sep 2012 13:41:10 -0700
parents 64272fc2350c
children e8f3b7994d88
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
1 #!/usr/bin/python
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
2 # CGI script creating page of recent games
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
3
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
4 import sys
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
5 import time
21
453278a81371 Add tablerecent() so recent.cgi will work as before.
John "Elwin" Edwards <elwin@sdf.org>
parents: 7
diff changeset
6 import rlgalldb as rlgall
7
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
7
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
8 # The required header
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
9 sys.stdout.write("Content-type: text/html\r\n\r\n")
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
10 # The top of the page
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
11 sys.stdout.write(rlgall.phead.format("Recent Games"))
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
12 sys.stdout.write(rlgall.ptop);
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
13 sys.stdout.write(rlgall.navtop.format("Recent"));
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
14 sys.stdout.write(rlgall.pti.format("Recent Expeditions"))
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
15
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
16 for game in rlgall.gamelist:
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
17 game.tablerecent(sys.stdout)
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
18
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
19 sys.stdout.write(rlgall.pend)
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
20 exit()