annotate web/scoring/players/index.cgi @ 33:25843238434a

Change the Python module's name back to rlgall. It is no longer an experimental variant. Using a database as a backend is a settled feature.
author John "Elwin" Edwards
date Thu, 02 Jan 2014 13:09:48 -0500
parents e8f3b7994d88
children 6138c27d1950
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30
e8f3b7994d88 Port to Python 3.
John "Elwin" Edwards
parents: 10
diff changeset
1 #!/usr/bin/python3
10
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
2
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
3 import os
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
4 import sys
33
25843238434a Change the Python module's name back to rlgall.
John "Elwin" Edwards
parents: 30
diff changeset
5 import rlgall
10
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
6
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
7 playerdir = "/var/www/lighttpd/scoring/players/"
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
8 linkstr = '<li><a href="./{0}.html">{0}</a></li>\n'
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
9
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
10 filelist = os.listdir(playerdir)
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
11 namelist = []
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
12
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
13 for filename in filelist:
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
14 if filename.endswith(".html"):
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
15 namelist.append(filename.rsplit(".html", 1)[0])
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
16 namelist.sort()
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
17
30
e8f3b7994d88 Port to Python 3.
John "Elwin" Edwards
parents: 10
diff changeset
18 sys.stdout.write("Content-Type: text/html; charset=utf-8\r\n\r\n")
10
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
19 sys.stdout.write(rlgall.phead.format("Players"))
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
20 sys.stdout.write(rlgall.ptop)
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
21 sys.stdout.write(rlgall.navscore.format("Players"))
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
22 sys.stdout.write(rlgall.pti.format("Players"))
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
23
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
24 if not namelist:
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
25 sys.stdout.write("<p>No one is here.</p>\n")
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
26 else:
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
27 sys.stdout.write("<ul>\n")
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
28 for name in namelist:
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
29 sys.stdout.write(linkstr.format(name))
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
30 sys.stdout.write("</ul>\n")
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
31
17f656035775 Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff changeset
32 sys.stdout.write(rlgall.pend)