fix #499846 by handling timedelta type in json serialization stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 23 Nov 2009 17:13:48 +0100
branchstable
changeset 3902 a0efb0326021
parent 3901 d197c07dcfe5
child 3903 7967d3766ecf
fix #499846 by handling timedelta type in json serialization
utils.py
--- a/utils.py	Mon Nov 23 16:18:13 2009 +0100
+++ b/utils.py	Mon Nov 23 17:13:48 2009 +0100
@@ -409,6 +409,8 @@
                 return obj.strftime('%Y/%m/%d')
             elif isinstance(obj, pydatetime.time):
                 return obj.strftime('%H:%M:%S')
+            elif isinstance(obj, pydatetime.timedelta):
+                return '%10d.%s' % (obj.days, obj.seconds)
             elif isinstance(obj, decimal.Decimal):
                 return float(obj)
             try: