S
sashang
Hi
Say I have a class like the following
class Test:
i = 1
def geti(self):
return self.i
And I use it in an xml-rpc server like this:
t = Test()
s.register_instance(t)
Then the client code can get the value of i like this:
c = xmlrpclib.ServerProxy("address")
c.geti()
but why can't I get the value of i like this?
c.i
How can I implement such behaviour? Moreover, if there were more member
objects in the class Test, how can tell the client 1) that these
attributes exist and 2) how can I use them from the client side without
having to resort to defining a function get_xxx() in the server class?
Say I have a class like the following
class Test:
i = 1
def geti(self):
return self.i
And I use it in an xml-rpc server like this:
t = Test()
s.register_instance(t)
Then the client code can get the value of i like this:
c = xmlrpclib.ServerProxy("address")
c.geti()
but why can't I get the value of i like this?
c.i
How can I implement such behaviour? Moreover, if there were more member
objects in the class Test, how can tell the client 1) that these
attributes exist and 2) how can I use them from the client side without
having to resort to defining a function get_xxx() in the server class?