utils.py
branchstable
changeset 4000 4b16a7c01a25
parent 3902 a0efb0326021
child 4012 f6c65e04704c
child 4212 ab6573088b4a
equal deleted inserted replaced
3999:5dd6ffc2ccae 4000:4b16a7c01a25
   408             elif isinstance(obj, pydatetime.date):
   408             elif isinstance(obj, pydatetime.date):
   409                 return obj.strftime('%Y/%m/%d')
   409                 return obj.strftime('%Y/%m/%d')
   410             elif isinstance(obj, pydatetime.time):
   410             elif isinstance(obj, pydatetime.time):
   411                 return obj.strftime('%H:%M:%S')
   411                 return obj.strftime('%H:%M:%S')
   412             elif isinstance(obj, pydatetime.timedelta):
   412             elif isinstance(obj, pydatetime.timedelta):
   413                 return '%10d.%s' % (obj.days, obj.seconds)
   413                 return (obj.days * 24 * 60 * 60) + obj.seconds
   414             elif isinstance(obj, decimal.Decimal):
   414             elif isinstance(obj, decimal.Decimal):
   415                 return float(obj)
   415                 return float(obj)
   416             try:
   416             try:
   417                 return JSONEncoder.default(self, obj)
   417                 return JSONEncoder.default(self, obj)
   418             except TypeError:
   418             except TypeError: