Package expedient :: Package common :: Package rpc4django :: Module jsonrpcdispatcher :: Class JSONRPCDispatcher
[hide private]
[frames] | no frames]

Class JSONRPCDispatcher

source code

JSONRPC Dispatcher

This class can be used encode and decode jsonrpc messages, dispatch the requested method with the passed parameters, and return any response or error.

Instance Methods [hide private]
 
__init__(self) source code
 
register_function(self, method, external_name)
Registers a method with the jsonrpc dispatcher.
source code
 
_encode_result(self, jsonid, result, error) source code
 
dispatch(self, json_data, **kwargs)
Verifies that the passed json encoded string is in the correct form according to the json-rpc spec and calls the appropriate method
source code
Method Details [hide private]

register_function(self, method, external_name)

source code 

Registers a method with the jsonrpc dispatcher.

This method can be called later via the dispatch method.

dispatch(self, json_data, **kwargs)

source code 

Verifies that the passed json encoded string 
is in the correct form according to the json-rpc spec
and calls the appropriate method

Checks:
 1. that the string encodes into a javascript Object (dictionary)
 2. that 'method' and 'params' are present
 3. 'method' must be a javascript String type
 4. 'params' must be a javascript Array type
 
Returns:
 the JSON encoded response