Allow to use dict with non string as keys over XML-RPC
issue8143 review45961002
This commit is contained in:
1 parent
9ee19c1abe
commit
80ee74f139
1 file changed
+14
@@ -62,6 +62,20 @@ if bytes != str:
|
||||
xmlrpc.client.Marshaller.dispatch[bytearray] = dump_bytes
|
||||
|
||||
|
||||
def dump_struct(self, value, write, escape=xmlrpc.client.escape):
|
||||
converted_value = {}
|
||||
for k, v in value.items():
|
||||
if isinstance(k, int):
|
||||
k = str(k)
|
||||
elif isinstance(k, float):
|
||||
k = repr(k)
|
||||
converted_value[k] = v
|
||||
return self.dump_struct(converted_value, write, escape=escape)
|
||||
|
||||
|
||||
xmlrpc.client.Marshaller.dispatch[dict] = dump_struct
|
||||
|
||||
|
||||
class XMLRPCDecoder(object):
|
||||
|
||||
decoders = {}
|
||||
|
||||
Reference in new issue
Block a user