Dispatches an XML-RPC method from marshalled (XML) data. XML-RPC methods are dispatched from the marshalled (XML) data using the _dispatch method and the result is returned as marshalled data. For backwards compatibility, a dispatch function can be provided as an arg
(self, data, dispatch_method = None, path = None)
| 242 | self.funcs['system.multicall'] = self.system_multicall |
| 243 | |
| 244 | def _marshaled_dispatch(self, data, dispatch_method = None, path = None): |
| 245 | """Dispatches an XML-RPC method from marshalled (XML) data. |
| 246 | |
| 247 | XML-RPC methods are dispatched from the marshalled (XML) data |
| 248 | using the _dispatch method and the result is returned as |
| 249 | marshalled data. For backwards compatibility, a dispatch |
| 250 | function can be provided as an argument (see comment in |
| 251 | SimpleXMLRPCRequestHandler.do_POST) but overriding the |
| 252 | existing method through subclassing is the preferred means |
| 253 | of changing method dispatch behavior. |
| 254 | """ |
| 255 | |
| 256 | try: |
| 257 | params, method = loads(data, use_builtin_types=self.use_builtin_types) |
| 258 | |
| 259 | # generate response |
| 260 | if dispatch_method is not None: |
| 261 | response = dispatch_method(method, params) |
| 262 | else: |
| 263 | response = self._dispatch(method, params) |
| 264 | # wrap response in a singleton tuple |
| 265 | response = (response,) |
| 266 | response = dumps(response, methodresponse=1, |
| 267 | allow_none=self.allow_none, encoding=self.encoding) |
| 268 | except Fault as fault: |
| 269 | response = dumps(fault, allow_none=self.allow_none, |
| 270 | encoding=self.encoding) |
| 271 | except BaseException as exc: |
| 272 | response = dumps( |
| 273 | Fault(1, "%s:%s" % (type(exc), exc)), |
| 274 | encoding=self.encoding, allow_none=self.allow_none, |
| 275 | ) |
| 276 | |
| 277 | return response.encode(self.encoding, 'xmlcharrefreplace') |
| 278 | |
| 279 | def system_listMethods(self): |
| 280 | """system.listMethods() => ['add', 'subtract', 'multiple'] |