view web/scoring/players/index.cgi @ 100:44e8aaa20d02
default tip
Fix the format of archive links.
author
John "Elwin" Edwards
date
Wed, 03 Aug 2022 20:49:38 -0400 (2022-08-04)
parents
6138c27d1950
children
line source
+ − #!/usr/bin/python3
+ −
+ − import os
+ − import sys
+ − import html
+ − import 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(html.escape(name)))
+ − sys.stdout.write("</ul>\n")
+ −
+ − sys.stdout.write(rlgall.pend)