0

I was reading the documentation of the register_instance method on SimpleXMLRPCServer. It has a method signature of:

SimpleXMLRPCServer.register_instance(instance[, allow_dotted_names])

and I read about the _dispatch() method:

If instance contains a _dispatch() method, it is called with the requested method name and the parameters from the request. Its API is def _dispatch(self, method, params) (note that params does not represent a variable argument list). If it calls an underlying function to perform its task, that function is called as func(*params), expanding the parameter list. The return value from _dispatch() is returned to the client as the result. If instance does not have a _dispatch() method, it is searched for an attribute matching the name of the requested method

What is this _dispatch() method?

gilbertbw
  • 634
  • 2
  • 9
  • 27
Hemant
  • 1,313
  • 17
  • 30
  • 1
    Can you at least give a link to the API? – SethMMorton Dec 04 '13 at 07:34
  • @SethMMorton I'm sorry but I don't know what api the docs are refferening too and If i knew that I wouldn't be asking the question in first place. If it would be of any help this is where i read the description - http://docs.python.org/2/library/simplexmlrpcserver.html#simplexmlrpcserver-objects – Hemant Dec 04 '13 at 08:19
  • I wasn't complaining that you didn't know or that you were asking the question. I was complaining that you were asking about an API without giving the link so I could help you out by reading the documentation. When asking for help, make sure you make it easy for people to help you. – SethMMorton Dec 04 '13 at 18:41
  • @SethMMorton I'm sorry if i've offended you. I didn't mean that. I'll make sure of these kind of thing in future. I'm new to this world and sometimes not able to make things clear to people over the web. – Hemant Dec 05 '13 at 06:34
  • I took no offense. No worries. – SethMMorton Dec 05 '13 at 07:41

1 Answers1

3

I went through the code of SimpleXMLRPCServer and found about the _dispatch method. This is the method to resolve the call to the function on server side when requested by client. This is the doc statement - "

        XML-RPC calls are forwarded to a registered function that
        matches the called XML-RPC method name. If no such function
        exists then the call is forwarded to the registered instance,
        if available.

        If the registered instance has a _dispatch method then that
        method will be called with the name of the XML-RPC method and
        its parameters as a tuple
        e.g. instance._dispatch('add',(2,3))

        If the registered instance does not have a _dispatch method
        then the instance will be searched to find a matching method
        and, if found, will be called.

        Methods beginning with an '_' are considered private and will
        not be called."
Hemant
  • 1,313
  • 17
  • 30