Browse files

Handle dates too.

fedmsg.encoding can handle encoding datetime objects and time structs.

This allows it to handle objects too.
  • Loading branch information...
1 parent 619dc1e commit 1635c49110a4145cedf2d105533b2adae4ff2422 @ralphbean ralphbean committed Feb 20, 2014
Showing with 1 addition and 1 deletion.
  1. +1 −1 fedmsg/encoding/
@@ -65,7 +65,7 @@ class FedMsgEncoder(json.encoder.JSONEncoder):
def default(self, obj):
if hasattr(obj, '__json__'):
return obj.__json__()
- if isinstance(obj, datetime.datetime):
+ if isinstance(obj, (datetime.datetime,
return time.mktime(obj.timetuple())
if isinstance(obj, time.struct_time):
return time.mktime(obj)

0 comments on commit 1635c49

Please sign in to comment.