durusmail: quixote-users: XML-RPC handlers in Quixote
XML-RPC handlers in Quixote
2002-03-13
2002-03-13
2002-03-14
2002-03-14
2002-03-14
XML-RPC handlers in Quixote
Neil Schemenauer
2002-03-14
On Thu, Mar 14, 2002 at 11:45:06AM -0500, Andrew Kuchling wrote:
> def rpc_process (method_name, params):
>     if method_name == 'login':
>         user_id, password = params
>         return login_func(user_id, password)
>     elif method_name == 'method2':
>         ...
>     elif ...

Why not use a table:

    {'login': login_func,
     'method2': ...
    }

Alternatively, you could create a class and use getattr() to find the
right method and apply() to call it.  You could have a base class that
takes care of all the grunt work and subclass it to add more RPC
methods.

OTOH, I'd don't know beans about XML-RPC so maybe this is all nonsense.

  Neil


reply