Exemple #1
0
 def render(self, request):
     request.content.seek(0, 0)
     # Unmarshal the JSON-RPC data
     content = request.content.read()
     parsed = jsonrpclib.loads(content)
     args, functionPath, requestId = parsed.get('params'), parsed.get("method"), parsed.get("id", None)
     try:
         function = self._getFunction(functionPath)
     except jsonrpclib.Fault, f:
         self._cbRender(f, request, requestId)
Exemple #2
0
 def parseResponse(self, contents):
     if not self.deferred:
         return
     try:
         # convert the response from JSON-RPC to python
         #print "Python type of response contents: %s" % type(contents)
         #print "Response contents: %s" % contents
         response = jsonrpclib.loads(contents)
         #print "Parsed contents: %s" % response
         #if isinstance(response, list):
         #    response = response[0]
     except Exception, error:
         self.deferred.errback(error)
         self.deferred = None
Exemple #3
0
 def parseResponse(self, contents):
     if not self.deferred:
         return
     try:
         # convert the response from JSON-RPC to python
         result = jsonrpclib.loads(contents)
         #response = jsonrpclib.loads(contents)
         #result = response['result']
         #error = response['error']
         #if error:
         #    self.deferred.errback(error)
         if isinstance(result, list):
             result = result[0]
     except Exception, error:
         self.deferred.errback(error)
         self.deferred = None