I'm using Pyro in a project, and can't seem to understand how to transfer a complete object over the wire. The object is not distributed (my distributed objects works perfectly fine), but should function as an argument to an already available distributed object.
My object is a derived from a custom class containing some methods and some variables - an integer and a list. The class is available for both the server and the client. When using my object as an argument to a method of a distributed object the integer variable is "received" correctly, but the list is empty, even though I can see that it contains values just before it's "sent".
Why is this?
Short version of the class:
class Collection(Pyro.core.ObjBase):
num = 0
operations = [("Operation:", "Value:", "Description", "Timestamp")]
def __init__(self):
Pyro.core.ObjBase.__init__(self)
def add(self, val, desc):
entry = ("Add", val, desc, strftime("%Y-%m-%d %H:%M:%S"))
self.operations.append(entry)
self.num = self.num + 1
def printop(self):
print "This collection will execute the following operations:"
for item in self.operations:
print item
The receving method in the distributed object:
def apply(self, collection):
print "Todo: Apply collection"
#op = collection.getop()
print "Number of collected operations:", collection.a
collection.printop()