mirroring object attributes using xml-rpc

sashang at gmail.com sashang at gmail.com
Wed Jul 5 19:12:29 EDT 2006


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?




More information about the Python-list mailing list