summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain <syt@logilab.fr>2006-10-31 19:17:44 +0100
committerSylvain <syt@logilab.fr>2006-10-31 19:17:44 +0100
commitf589054f7a557636b093d333fe2bfc77e8f4b238 (patch)
tree34aaa44e11208a3ccd8d062b70301c40a33f9363
parent16ee6e31edb28e80fd4e5545a8b164f2c0472069 (diff)
downloadlogilab-common-f589054f7a557636b093d333fe2bfc77e8f4b238.tar.gz
fix
-rw-r--r--db.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/db.py b/db.py
index 7b66fc8..4f9de76 100644
--- a/db.py
+++ b/db.py
@@ -230,7 +230,10 @@ class _Psycopg2Adapter(_PsycopgAdapter):
def cast_datetime(value, cursor):
if value:
- return strptime(value, '%Y-%m-%d %H:%M:%S')
+ # XXX value.split('.', 1)[0] to protect against
+ # date such as 2006-10-31 19:09:34.29
+ return strptime(value.split('.', 1)[0],
+ '%Y-%m-%d %H:%M:%S')
DATETIME = extensions.new_type(psycopg2.DATETIME.values, "DATETIME", cast_datetime)
for v in DATETIME.values: