[dataimport] Correctly serialize datetime objects in _create_copyfrom_buffer, closes #3712885
--- a/dataimport.py Thu Apr 03 15:36:33 2014 +0200
+++ b/dataimport.py Mon Apr 07 08:44:56 2014 +0000
@@ -472,11 +472,13 @@
if isinstance(value, unicode):
value = value.encode(encoding)
elif isinstance(value, (date, datetime)):
- # Do not use strftime, as it yields issue
- # with date < 1900
value = '%04d-%02d-%02d' % (value.year,
value.month,
value.day)
+ if isinstance(value, datetime):
+ value += ' %02d:%02d:%02d' % (value.hour,
+ value.minutes,
+ value.second)
else:
return None
# We push the value to the new formatted row