From 86a713e9f7e23f95a8e72fa4898ade655aff2eda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 8 Jun 2008 20:57:50 +0200 Subject: [PATCH] Make get_ in webdav more fault tolerant for issue98 --- trytond/webdav/webdav.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/trytond/webdav/webdav.py b/trytond/webdav/webdav.py index 4e070ffac9..144d02e027 100644 --- a/trytond/webdav/webdav.py +++ b/trytond/webdav/webdav.py @@ -224,7 +224,8 @@ class Collection(OSV): cursor.execute('SELECT EXTRACT(epoch FROM create_date) ' \ 'FROM "' + model_obj._table +'" ' \ 'WHERE id = %s', (object_id,)) - return cursor.fetchone()[0] + if cursor.rowcount: + return cursor.fetchone()[0] return time.time() def get_lastmodified(self, cursor, user, uri, context=None): @@ -235,7 +236,8 @@ class Collection(OSV): cursor.execute('SELECT EXTRACT(epoch FROM write_date) ' \ 'FROM "' + model_obj._table +'" ' \ 'WHERE id = %s', (object_id,)) - return cursor.fetchone()[0] + if cursor.rowcount: + return cursor.fetchone()[0] return time.time() def get_data(self, cursor, user, uri, context=None):