comparison web/archive.cgi @ 4:f5a37cc7f41f

Continue removing the time module. Convert some more struct_time instances to datetime objects.
author John "Elwin" Edwards <elwin@sdf.org>
date Thu, 26 Jul 2012 10:14:56 -0700
parents a943cfdfbad9
children a583700c0ca4
comparison
equal deleted inserted replaced
3:a943cfdfbad9 4:f5a37cc7f41f
53 soptstr = '<option value="{0}" label="{1}" selected="selected">{1}</option>\n' 53 soptstr = '<option value="{0}" label="{1}" selected="selected">{1}</option>\n'
54 tf = '<input type="text" size="2" maxlength="2" name="{0}" value="{1:02}">' 54 tf = '<input type="text" size="2" maxlength="2" name="{0}" value="{1:02}">'
55 emptf = '<input type="text" size="2" maxlength="2" name="{0}">' 55 emptf = '<input type="text" size="2" maxlength="2" name="{0}">'
56 sstr = '<div>Date: <select name="year">\n' 56 sstr = '<div>Date: <select name="year">\n'
57 # Default to today 57 # Default to today
58 now = time.gmtime() 58 now = datetime.now(rlgall.utc)
59 for dindex in range(3): 59 if dvals[0] != None:
60 if not dvals[dindex]: 60 dvals[0] = now.year
61 dvals[dindex] = now[dindex] 61 if dvals[1] != None:
62 for year in range(2010, now[0] + 1): 62 dvals[1] = now.month
63 if dvals[2] != None:
64 dvals[2] = now.day
65 for year in range(2010, now.year + 1):
63 if year == dvals[0]: 66 if year == dvals[0]:
64 sstr += soptstr.format(year, year) 67 sstr += soptstr.format(year, year)
65 else: 68 else:
66 sstr += optstr.format(year, year) 69 sstr += optstr.format(year, year)
67 sstr += '</select>\n' 70 sstr += '</select>\n'
277 searchtime = processtime(fdata, errors, timepieces) 280 searchtime = processtime(fdata, errors, timepieces)
278 281
279 dosearch = formname != None and dungeon != None and searchtime != None 282 dosearch = formname != None and dungeon != None and searchtime != None
280 283
281 # Find the actual files, and put them in a list called gamefiles. 284 # Find the actual files, and put them in a list called gamefiles.
282 gtimes = [0, int(time.time())]
283 relgame = None
284 gamefiles = [] 285 gamefiles = []
285 if dosearch: 286 if dosearch:
286 query1 = "SELECT ttyrecs FROM {0} WHERE name = %s AND startt <= %s AND endt >= %s;".format(dungeon.uname) 287 query1 = "SELECT ttyrecs FROM {0} WHERE name = %s AND startt <= %s AND endt >= %s;".format(dungeon.uname)
287 query2 = "SELECT ttyrecs FROM {0} WHERE name = %s AND endt >= %s ORDER BY endt LIMIT 1;".format(dungeon.uname) 288 query2 = "SELECT ttyrecs FROM {0} WHERE name = %s AND endt >= %s ORDER BY endt LIMIT 1;".format(dungeon.uname)
288 query3 = "SELECT ttyrecs FROM {0} WHERE name = %s AND startt <= %s ORDER BY startt DESC LIMIT 1;".format(dungeon.uname) 289 query3 = "SELECT ttyrecs FROM {0} WHERE name = %s AND startt <= %s ORDER BY startt DESC LIMIT 1;".format(dungeon.uname)