summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/db.py b/db.py
index fb1bac1..f912c4b 100644
--- a/db.py
+++ b/db.py
@@ -410,8 +410,18 @@ class _PySqlite2Adapter(DBAPIAdapter):
# DateTime used as Time?
return strptime(ustr, '%Y-%m-%d %H:%M:%S')
sqlite.register_converter('time', convert_mxtime)
- # XXX else use datetime.datetime
-
+ # else use datetime.datetime
+ else:
+ from datetime import time
+ def adapt_time(data):
+ return data.strftime('%H:%M:%S')
+ sqlite.register_adapter(time, adapt_time)
+ def convert_time(data):
+ return time(*[int(i) for i in data.split(':')])
+ sqlite.register_converter('time', convert_time)
+
+
+
def connect(self, host='', database='', user='', password='', port=None):
"""Handles sqlite connexion format"""