Mercurial > hg > rlgallery-misc
view 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 |
line wrap: on
line source
#!/usr/bin/python3 import os import sys import rlgalldb as rlgall playerdir = "/var/www/lighttpd/scoring/players/" linkstr = '<li><a href="./{0}.html">{0}</a></li>\n' filelist = os.listdir(playerdir) namelist = [] for filename in filelist: if filename.endswith(".html"): namelist.append(filename.rsplit(".html", 1)[0]) namelist.sort() sys.stdout.write("Content-Type: text/html; charset=utf-8\r\n\r\n") sys.stdout.write(rlgall.phead.format("Players")) sys.stdout.write(rlgall.ptop) sys.stdout.write(rlgall.navscore.format("Players")) sys.stdout.write(rlgall.pti.format("Players")) if not namelist: sys.stdout.write("<p>No one is here.</p>\n") else: sys.stdout.write("<ul>\n") for name in namelist: sys.stdout.write(linkstr.format(name)) sys.stdout.write("</ul>\n") sys.stdout.write(rlgall.pend)