diff --git a/client/djrandom_client/upload.py b/client/djrandom_client/upload.py index 324479759a7cbac4bbb8bb018f043cdd4c5489e5..38c6628a4bd20b4ed02fcb5cbf9b3df1dcc0f751 100644 --- a/client/djrandom_client/upload.py +++ b/client/djrandom_client/upload.py @@ -34,8 +34,8 @@ class FileDatabase(object): if is_new: self.conn.execute( - 'create table seen (sha1 text(40), stamp integer, ' - 'primary key (sha1))') + 'create table seen (path text(1024), stamp integer, ' + 'primary key (path))') self.conn.commit() def close(self): @@ -44,16 +44,16 @@ class FileDatabase(object): def has(self, key): c = self.conn.cursor() row = c.execute( - 'select stamp from seen where sha1 = ?', (key,) + 'select stamp from seen where path = ?', (key,) ).fetchone() if row: - return True + return row[0] else: - return False + return None def add(self, key): c = self.conn.cursor() - c.execute('insert or replace into seen (sha1, stamp) values (?, ?)', + c.execute('insert or replace into seen (path, stamp) values (?, ?)', (key, int(time.time()))) self.conn.commit()