comparison py/rlgall.py @ 100:44e8aaa20d02 default tip

Fix the format of archive links.
author John "Elwin" Edwards
date Wed, 03 Aug 2022 20:49:38 -0400
parents d417016bbf73
children
comparison
equal deleted inserted replaced
99:801ec25cc0af 100:44e8aaa20d02
84 lstr = '<a href="/scoring/players/' + escname + '.html">' + escname + '</a>' 84 lstr = '<a href="/scoring/players/' + escname + '.html">' + escname + '</a>'
85 return lstr 85 return lstr
86 86
87 def linktoArchive(entry): 87 def linktoArchive(entry):
88 "Takes an entry dict and returns a link to the ttyrec archivist." 88 "Takes an entry dict and returns a link to the ttyrec archivist."
89 lstr = '<a href="/archive.cgi?name={0};game={1};time={2}">{3}</a>' 89 lstr = '<a href="/archive.cgi?name={0}&amp;game={1}&amp;time={2}">{3}</a>'
90 linktext = entry["endt"].strftime("%Y/%m/%d %H:%M:%S") 90 linktext = entry["endt"].strftime("%Y/%m/%d %H:%M:%S")
91 stamp = int(entry["endt"].timestamp()) 91 stamp = int(entry["endt"].timestamp())
92 escname = html.escape(entry["name"]) 92 escname = html.escape(entry["name"])
93 return lstr.format(escname, entry["game"].uname, stamp, linktext) 93 return lstr.format(escname, entry["game"].uname, stamp, linktext)
94 94
213 cur.execute(tquery, [nameF]) 213 cur.execute(tquery, [nameF])
214 result = cur.fetchone() 214 result = cur.fetchone()
215 if result: 215 if result:
216 prev = result[0] 216 prev = result[0]
217 else: 217 else:
218 prev = datetime.fromtimestamp(0, pytz.utc); 218 prev = datetime.fromtimestamp(0, pytz.utc)
219 ttyrecdir = "/var/dgl/dgldir/ttyrec/{0}/{1}/".format(nameF, self.uname) 219 ttyrecdir = "/var/dgl/dgldir/ttyrec/{0}/{1}/".format(nameF, self.uname)
220 allfilekeys = [ (recnameToTS(f), f) for f in os.listdir(ttyrecdir) ] 220 allfilekeys = [ (recnameToTS(f), f) for f in os.listdir(ttyrecdir) ]
221 vfilekeys = [ e for e in allfilekeys if e[0] > prev ] 221 vfilekeys = [ e for e in allfilekeys if e[0] > prev ]
222 vfilekeys.sort(key=lambda e: e[0]) 222 vfilekeys.sort(key=lambda e: e[0])
223 # Now determine startt and ttyrecs for each game 223 # Now determine startt and ttyrecs for each game