Datetime objects in JSON are integers, not strings.

This commit is contained in:
Michael Richardson 2010-02-13 03:22:54 +08:00 committed by Mike Dirolf
parent 343eb506d7
commit 0615b830bb

View File

@ -80,7 +80,7 @@ def default(obj):
# TODO share this code w/ bson.py?
millis = int(calendar.timegm(obj.timetuple()) * 1000 +
obj.microsecond / 1000)
return {"$date": str(millis)}
return {"$date": millis}
if isinstance(obj, _RE_TYPE):
flags = ""
if obj.flags & re.IGNORECASE: