From 4e4f0bb783b98f4832b0089544006495e4a0849b Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 16 Nov 2013 20:59:57 -0500 Subject: [PATCH] Fix datetime usage, indexing. --- tasks/afc_statistics.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasks/afc_statistics.py b/tasks/afc_statistics.py index 3b84dd6..cf3e120 100644 --- a/tasks/afc_statistics.py +++ b/tasks/afc_statistics.py @@ -655,8 +655,9 @@ class AFCStatistics(Task): ORDER BY ABS(rev_timestamp - ?) ASC LIMIT 1""" result = self.site.sql_query(query, (pageid, user, stamp, stamp)) try: - return user, stamp, list(result)[0] - except IndexError: + dtime = datetime.strptime(stamp, "%Y%m%d%H%M%S") + return user, dtime, list(result)[0][0] + except (ValueError, IndexError): return None def _search_history(self, pageid, chart, search_with, search_without):