プロジェクトで Pyro を使用していますが、完全なオブジェクトをネットワーク経由で転送する方法がわかりません。オブジェクトは分散されていません(私の分散オブジェクトは問題なく動作します) が、既に利用可能な分散オブジェクトへの引数として機能する必要があります。
私のオブジェクトは、いくつかのメソッドといくつかの変数 (整数とリスト) を含むカスタム クラスから派生したものです。このクラスは、サーバーとクライアントの両方で使用できます。オブジェクトを分散オブジェクトのメソッドへの引数として使用すると、整数変数は正しく「受信」されますが、「送信」される直前の値が含まれていることがわかりますが、リストは空です。
どうしてこれなの?
クラスの短いバージョン:
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
分散オブジェクトでの受信方法:
def apply(self, collection):
print "Todo: Apply collection"
#op = collection.getop()
print "Number of collected operations:", collection.a
collection.printop()