Changeset - 6274adc06988
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 14 years ago 2011-12-21 01:07:41
marcin@python-works.com
fixed RPC call for api that was missing request id
1 file changed with 7 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/api/__init__.py
Show inline comments
 
@@ -224,26 +224,31 @@ class JSONRPCController(WSGIController):
 
            self._error = str(json_exc)
 

	
 
        if self._error is not None:
 
            raw_response = None
 

	
 
        response = dict(id=self._req_id, result=raw_response,
 
                        error=self._error)
 

	
 
        try:
 
            return json.dumps(response)
 
        except TypeError, e:
 
            log.debug('Error encoding response: %s', e)
 
            return json.dumps(dict(result=None,
 
                                   error="Error encoding response"))
 
            return json.dumps(
 
                dict(
 
                    self._req_id,
 
                    result=None,
 
                    error="Error encoding response"
 
                )
 
            )
 

	
 
    def _find_method(self):
 
        """
 
        Return method named by `self._req_method` in controller if able
 
        """
 
        log.debug('Trying to find JSON-RPC method: %s', self._req_method)
 
        if self._req_method.startswith('_'):
 
            raise AttributeError("Method not allowed")
 

	
 
        try:
 
            func = getattr(self, self._req_method, None)
 
        except UnicodeEncodeError:
0 comments (0 inline, 0 general)