view web/recent.cgi @ 68:67bcca6e3cb1

Prevent crashes if no ttyrec files can be associated with a game. If the postprocessing step finds no ttyrec files created between a game's end and the previous game's end, it will no longer index an empty list and crash. The condition of finding no ttyrec files is still a bug that requires investigation.
author John "Elwin" Edwards
date Sat, 16 Jan 2016 02:12:50 +0000
parents 25843238434a
children 44e8aaa20d02
line wrap: on
line source

#!/usr/bin/python3
# CGI script creating page of recent games

import sys
import time
import rlgall

# It is assumed that sys.stdout uses UTF-8 encoding.  If this is not the case,
# configure the Web server to set the LC_CTYPE environment variable to a UTF-8
# locale.

# The required header
sys.stdout.write("Content-Type: text/html; charset=utf-8\r\n\r\n")
# The top of the page
sys.stdout.write(rlgall.phead.format("Recent Games"))
sys.stdout.write(rlgall.ptop);
sys.stdout.write(rlgall.navtop.format("Recent"));
sys.stdout.write(rlgall.pti.format("Recent Expeditions"))

for game in rlgall.gamelist:
  game.tablerecent(sys.stdout)

sys.stdout.write(rlgall.pend)
exit()