Show More
@@ -74,21 +74,9 b' def squash_unicode(obj):' | |||||
74 | #----------------------------------------------------------------------------- |
|
74 | #----------------------------------------------------------------------------- | |
75 |
|
75 | |||
76 |
|
76 | |||
77 | # jsonlib behaves a bit differently, so handle that where it affects us |
|
77 | # ISO8601-ify datetime objects | |
78 | if jsonapi.jsonmod.__name__ == 'jsonlib': |
|
78 | json_packer = lambda obj: jsonapi.dumps(obj, default=date_default) | |
79 | # kwarg for serializing unknown types (datetime) is different |
|
79 | json_unpacker = lambda s: extract_dates(jsonapi.loads(s)) | |
80 | dumps_kwargs = dict(on_unknown=date_default) |
|
|||
81 | # By default, jsonlib unpacks floats as Decimal instead of float, |
|
|||
82 | # which can foul things up |
|
|||
83 | loads_kwargs = dict(use_float=True) |
|
|||
84 | else: |
|
|||
85 | # ISO8601-ify datetime objects |
|
|||
86 | dumps_kwargs = dict(default=date_default) |
|
|||
87 | # nothing to specify for loads |
|
|||
88 | loads_kwargs = dict() |
|
|||
89 |
|
||||
90 | json_packer = lambda obj: jsonapi.dumps(obj, **dumps_kwargs) |
|
|||
91 | json_unpacker = lambda s: extract_dates(jsonapi.loads(s, **loads_kwargs)) |
|
|||
92 |
|
80 | |||
93 | pickle_packer = lambda o: pickle.dumps(o,-1) |
|
81 | pickle_packer = lambda o: pickle.dumps(o,-1) | |
94 | pickle_unpacker = pickle.loads |
|
82 | pickle_unpacker = pickle.loads |
General Comments 0
You need to be logged in to leave comments.
Login now