I use PyRo in my python programm. And I have a problem. class B: In callFromProxy print 0, but in callfun print right value = 10. Why? How to fix?
class A(Pyro.core.ObjBase):
# set link to item class B
def set(self, real_B):
self.item_B = real_B
# call function callfun in item_B
def callfun(self):
self.item_B.callfun(10)
class B(Pyro.core.ObjBase):
# init class B
def __init__(self):
self.elements = {"name":0}
# set proxy to item class A
def set(self, proxyA):
self.proxyA = proxyA
# print
def printvalue(self):
print self.elements["name"]
# call from proxy
def callFromProxy(self):
self.proxyA.callfun()
self.printvalue() # this is not print 10, print 0
# call function
def callfun(self, value):
self.elements["name"] = value
self.printvalue() # but this is print 10
itemA = A()
# proxyA connect from PyRo to itemA
itemB = B()
itemB.set(itemA)
itemA.set(itemB)
itemB.callFromProxy() # this is not print 10