From 757eeb6675792b5d8c8c5d40ea3f3ce9231d641f Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Thu, 3 Jun 2010 17:49:01 +0200 Subject: quotes: Import the time module. --- modules/quotes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/quotes.py b/modules/quotes.py index 772701c..cf2cdbe 100644 --- a/modules/quotes.py +++ b/modules/quotes.py @@ -4,7 +4,7 @@ info = { 'description': 'Allows users to access a quote database.', } -import random +import random, time from pyPgSQL import PgSQL class Quotes: @@ -27,7 +27,7 @@ class Quotes: def add(self, nick, quote): cur = self.db.cursor() - cur.execute('insert into quotes (nick, date, quote) values (%s, extract(epoch FROM now()), %s)', (nick, quote)) + cur.execute('insert into quotes (nick, date, quote) values (%s, %d, %s)', (nick, int(time.time()), quote)) cur.execute('select currval(\'quotes_id_seq\')') lastrowid = cur.fetchone()[0] cur.close() -- cgit v1.2.3