Manage microseconds in JSON-RPC and XML-RPC
review3551002
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Manage microseconds in JSON-RPC and XML-RPC
|
||||
* Remove Sha field
|
||||
* Add password widget
|
||||
* Add Len to PYSON
|
||||
|
||||
@@ -37,11 +37,12 @@ def object_hook(dct):
|
||||
if '__class__' in dct:
|
||||
if dct['__class__'] == 'datetime':
|
||||
return datetime.datetime(dct['year'], dct['month'], dct['day'],
|
||||
dct['hour'], dct['minute'], dct['second'])
|
||||
dct['hour'], dct['minute'], dct['second'], dct['microsecond'])
|
||||
elif dct['__class__'] == 'date':
|
||||
return datetime.date(dct['year'], dct['month'], dct['day'])
|
||||
elif dct['__class__'] == 'time':
|
||||
return datetime.time(dct['hour'], dct['minute'], dct['second'])
|
||||
return datetime.time(dct['hour'], dct['minute'], dct['second'],
|
||||
dct['microsecond'])
|
||||
elif dct['__class__'] == 'buffer':
|
||||
return buffer(base64.decodestring(dct['base64']))
|
||||
elif dct['__class__'] == 'Decimal':
|
||||
@@ -66,6 +67,7 @@ class JSONEncoder(json.JSONEncoder):
|
||||
'hour': obj.hour,
|
||||
'minute': obj.minute,
|
||||
'second': obj.second,
|
||||
'microsecond': obj.microsecond,
|
||||
}
|
||||
return {'__class__': 'date',
|
||||
'year': obj.year,
|
||||
@@ -77,6 +79,7 @@ class JSONEncoder(json.JSONEncoder):
|
||||
'hour': obj.hour,
|
||||
'minute': obj.minute,
|
||||
'second': obj.second,
|
||||
'microsecond': obj.microsecond,
|
||||
}
|
||||
elif isinstance(obj, buffer):
|
||||
return {'__class__': 'buffer',
|
||||
|
||||
@@ -49,6 +49,7 @@ def dump_time(self, value, write):
|
||||
'hour': value.hour,
|
||||
'minute': value.minute,
|
||||
'second': value.second,
|
||||
'microsecond': value.microsecond,
|
||||
}
|
||||
self.dump_struct(value, write)
|
||||
|
||||
@@ -84,7 +85,8 @@ def end_struct(self, data):
|
||||
if dct['__class__'] == 'date':
|
||||
dct = datetime.date(dct['year'], dct['month'], dct['day'])
|
||||
elif dct['__class__'] == 'time':
|
||||
dct = datetime.time(dct['hour'], dct['minute'], dct['second'])
|
||||
dct = datetime.time(dct['hour'], dct['minute'], dct['second'],
|
||||
dct['microsecond'])
|
||||
elif dct['__class__'] == 'Decimal':
|
||||
dct = Decimal(dct['decimal'])
|
||||
self._stack[mark:] = [dct]
|
||||
|
||||
Reference in New Issue
Block a user