changeset 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
files py/rlgalldb.py web/archive.cgi
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/py/rlgalldb.py	Thu Jul 26 09:35:07 2012 -0700
+++ b/py/rlgalldb.py	Thu Jul 26 10:14:56 2012 -0700
@@ -2,7 +2,6 @@
 # Module for the Roguelike Gallery, using a postgres database
 
 import os
-import time
 import calendar
 import psycopg2
 from datetime import datetime, tzinfo, timedelta
--- a/web/archive.cgi	Thu Jul 26 09:35:07 2012 -0700
+++ b/web/archive.cgi	Thu Jul 26 10:14:56 2012 -0700
@@ -55,11 +55,14 @@
   emptf = '<input type="text" size="2" maxlength="2" name="{0}">'
   sstr = '<div>Date: <select name="year">\n'
   # Default to today
-  now = time.gmtime()
-  for dindex in range(3):
-    if not dvals[dindex]:
-      dvals[dindex] = now[dindex]
-  for year in range(2010, now[0] + 1):
+  now = datetime.now(rlgall.utc)
+  if dvals[0] != None:
+    dvals[0] = now.year
+  if dvals[1] != None:
+    dvals[1] = now.month
+  if dvals[2] != None:
+    dvals[2] = now.day
+  for year in range(2010, now.year + 1):
     if year == dvals[0]:
       sstr += soptstr.format(year, year)
     else:
@@ -279,8 +282,6 @@
 dosearch = formname != None and dungeon != None and searchtime != None
 
 # Find the actual files, and put them in a list called gamefiles.
-gtimes = [0, int(time.time())]
-relgame = None
 gamefiles = []
 if dosearch:
   query1 = "SELECT ttyrecs FROM {0} WHERE name = %s AND startt <= %s AND endt >= %s;".format(dungeon.uname)