Exemplo n.º 1
0
 def stringReceived(self, line):
     parser, unmarshaller = jsonrpclib.getparser()
     deferred = defer.maybeDeferred(parser.feed, line)
     deferred.addCallback(lambda x: self._cbDispatch(parser, unmarshaller))
     deferred.addErrback(self._ebRender)
     deferred.addCallback(self._cbRender)
     return deferred
Exemplo n.º 2
0
    def test_getparser(self):
        """A parser and marshaller are returned."""
        parser, unmarshaller = jsonrpclib.getparser()

        self.assertTrue(isinstance(parser, jsonrpclib.SimpleParser))
        self.assertTrue(isinstance(unmarshaller, jsonrpclib.SimpleUnmarshaller))
        self.assertIs(parser, unmarshaller.parser)
Exemplo n.º 3
0
 def stringReceived(self, line):
     parser, unmarshaller = jsonrpclib.getparser()
     deferred = defer.maybeDeferred(parser.feed, line)
     deferred.addCallback(lambda x: self._cbDispatch(
         parser, unmarshaller))
     deferred.addErrback(self._ebRender)
     deferred.addCallback(self._cbRender)
     return deferred
Exemplo n.º 4
0
 def http_POST(self, request):
     parser, unmarshaller = jsonrpclib.getparser()
     deferred = stream.readStream(request.stream, parser.feed)
     deferred.addCallback(lambda x: self._cbDispatch(
         request, parser, unmarshaller))
     deferred.addErrback(self._ebRender)
     deferred.addCallback(self._cbRender, request)
     return deferred
Exemplo n.º 5
0
    def test_getparser(self):
        """A parser and marshaller are returned."""
        parser, unmarshaller = jsonrpclib.getparser()

        self.assertTrue(isinstance(parser, jsonrpclib.SimpleParser))
        self.assertTrue(isinstance(unmarshaller,
                                   jsonrpclib.SimpleUnmarshaller))
        self.assertIs(parser, unmarshaller.parser)
Exemplo n.º 6
0
    def stringReceived(self, line):
        parser, unmarshaller = jsonrpclib.getparser()
        if isinstance(line, six.binary_type):
            line = line.decode('utf-8')
        deferred = defer.maybeDeferred(parser.feed, line)

        req, req_id = self._cbDispatch(parser, unmarshaller)
        deferred.addCallback(lambda x: req)
        deferred.addErrback(self._ebRender, req_id=req_id)
        deferred.addCallback(self._cbRender, req_id=req_id)
        return deferred
Exemplo n.º 7
0
    def stringReceived(self, line):
        parser, unmarshaller = jsonrpclib.getparser()
        if isinstance(line, six.binary_type):
            line = line.decode('utf-8')
        deferred = defer.maybeDeferred(parser.feed, line)

        req, req_id = self._cbDispatch(parser, unmarshaller)
        deferred.addCallback(lambda x: req)
        deferred.addErrback(self._ebRender, req_id=req_id)
        deferred.addCallback(self._cbRender, req_id=req_id)
        return deferred