I have a simple example to send a dictionary through xml-rpc:
class CTest(object):
def __init__(self):
self.node1 = {'data':'zek', 'parent':{}, 'children':[]}
self.node2 = {'data':'bill', 'parent':{}, 'children':[]}
self.node1['children'].append(self.node2)
self.node2['parent'] = self.node1
def getNode(self):
return self.node1
I have two dictionaries: node2 is the children of node1, and in the same time node2 has the reference of node1 as parent variable. So it is a recursive dictionary. When I try to send node1 through XML-RPC, I got this exception:
#Command to execute xml-rpc dump method for serialization
test = CTest()
xmlrpclib.dumps((test,), 'Node Object')
#Exception
raise TypeError, "cannot marshal recursive dictionaries"
Is it possible to send node1 through XML-RPC (without changing dictionary structure)?
Thanks.