XML-RPC Question

Jesper Olsen jolsen at mailme.dk
Fri Mar 15 03:28:06 EST 2002


"Brian Quinlan" <brian at sweetapp.com> wrote in message news:<mailman.1016136339.16111.python-list at python.org>...
> Jesper Olsen wrote:
> > Setting up a server goes something like this:

> While that usage is correct, it is a bit odd. There are two other ways
> that my might express this:
> 

> 
> server.register_instance(MyClass())
> 
> Of course I didn't test the above in any way :-)

Yes that works too.
I think it would be useful if the register_instance, registered
the name of the object as part of the method names, e.g.

server.register_instance(MyClass(), "myob")

It would then be clear to the client, that it is calling methods
on an object:

    server.myob.helloWorld()
    server.myob.echo()

I this example it does not matter much, but usually objects have a
state, whereas function calls give the impression of something state-less.
Of course the same can be achieved by registering these functions individually:

   server.register_function(myob.helloWorld, "myob.helloWorld")
   server.register_function(myob.echo, "myob.echo")
    
Cheers
Jesper



More information about the Python-list mailing list