comparison web/scoring/players/index.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 17f656035775
children 25843238434a
comparison
equal deleted inserted replaced
29:23a769aa487e 30:e8f3b7994d88
1 #!/usr/bin/python 1 #!/usr/bin/python3
2 2
3 import os 3 import os
4 import sys 4 import sys
5 import rlgall 5 import rlgalldb as rlgall
6 6
7 playerdir = "/var/www/lighttpd/scoring/players/" 7 playerdir = "/var/www/lighttpd/scoring/players/"
8 linkstr = '<li><a href="./{0}.html">{0}</a></li>\n' 8 linkstr = '<li><a href="./{0}.html">{0}</a></li>\n'
9 9
10 filelist = os.listdir(playerdir) 10 filelist = os.listdir(playerdir)
13 for filename in filelist: 13 for filename in filelist:
14 if filename.endswith(".html"): 14 if filename.endswith(".html"):
15 namelist.append(filename.rsplit(".html", 1)[0]) 15 namelist.append(filename.rsplit(".html", 1)[0])
16 namelist.sort() 16 namelist.sort()
17 17
18 sys.stdout.write("Content-type: text/html\r\n\r\n") 18 sys.stdout.write("Content-Type: text/html; charset=utf-8\r\n\r\n")
19 sys.stdout.write(rlgall.phead.format("Players")) 19 sys.stdout.write(rlgall.phead.format("Players"))
20 sys.stdout.write(rlgall.ptop) 20 sys.stdout.write(rlgall.ptop)
21 sys.stdout.write(rlgall.navscore.format("Players")) 21 sys.stdout.write(rlgall.navscore.format("Players"))
22 sys.stdout.write(rlgall.pti.format("Players")) 22 sys.stdout.write(rlgall.pti.format("Players"))
23 23