annotate web/recent.cgi @ 30:e8f3b7994d88

Port to Python 3. All scripts and modules have been ported to Python 3 and appear to work. Some changes to the lighttpd configuration were needed.
author John "Elwin" Edwards
date Tue, 31 Dec 2013 13:36:19 -0500
parents 453278a81371
children 25843238434a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30
e8f3b7994d88 Port to Python 3.
John "Elwin" Edwards
parents: 21
diff changeset
1 #!/usr/bin/python3
7
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
30
e8f3b7994d88 Port to Python 3.
John "Elwin" Edwards
parents: 21
diff changeset
8 # It is assumed that sys.stdout uses UTF-8 encoding. If this is not the case,
e8f3b7994d88 Port to Python 3.
John "Elwin" Edwards
parents: 21
diff changeset
9 # configure the Web server to set the LC_CTYPE environment variable to a UTF-8
e8f3b7994d88 Port to Python 3.
John "Elwin" Edwards
parents: 21
diff changeset
10 # locale.
e8f3b7994d88 Port to Python 3.
John "Elwin" Edwards
parents: 21
diff changeset
11
7
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
12 # The required header
30
e8f3b7994d88 Port to Python 3.
John "Elwin" Edwards
parents: 21
diff changeset
13 sys.stdout.write("Content-Type: text/html; charset=utf-8\r\n\r\n")
7
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
14 # The top of the page
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
15 sys.stdout.write(rlgall.phead.format("Recent Games"))
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
16 sys.stdout.write(rlgall.ptop);
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
17 sys.stdout.write(rlgall.navtop.format("Recent"));
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
18 sys.stdout.write(rlgall.pti.format("Recent Expeditions"))
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
19
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
20 for game in rlgall.gamelist:
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
21 game.tablerecent(sys.stdout)
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
22
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
23 sys.stdout.write(rlgall.pend)
64272fc2350c Begin importing the website.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
24 exit()