Python twisted.internet.defer.execute() Examples

The following are 14 code examples of twisted.internet.defer.execute(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module twisted.internet.defer , or try the search function .
Example #1
Source File: amp.py    From landscape-client with GNU General Public License v2.0 6 votes vote down vote up
def __getattr__(self, name):
        """
        Pass attributes through to the real L{BrokerServer}, after checking
        that they're encodable with AMP.
        """
        original = getattr(self.broker_server, name, None)
        if (name in get_remote_methods(self.broker_server) and
            original is not None and
            callable(original)
            ):
            def method(*args, **kwargs):
                for arg in args:
                    assert MethodCallArgument.check(arg)
                for k, v in iteritems(kwargs):
                    assert MethodCallArgument.check(v)
                return execute(original, *args, **kwargs)
            return method
        else:
            raise AttributeError(name) 
Example #2
Source File: endpoints.py    From Safejumper-for-Desktop with GNU General Public License v2.0 5 votes vote down vote up
def listen(self, stdioProtocolFactory):
        """
        Implement L{IStreamServerEndpoint.listen} to listen on stdin/stdout
        """
        return defer.execute(self._stdio,
                             stdioProtocolFactory.buildProtocol(PipeAddress()),
                             reactor=self._reactor) 
Example #3
Source File: endpoints.py    From Safejumper-for-Desktop with GNU General Public License v2.0 5 votes vote down vote up
def listen(self, protocolFactory):
        """
        Implement L{IStreamServerEndpoint.listen} to listen on a TCP
        socket
        """
        return defer.execute(self._reactor.listenTCP,
                             self._port,
                             protocolFactory,
                             backlog=self._backlog,
                             interface=self._interface) 
Example #4
Source File: endpoints.py    From Safejumper-for-Desktop with GNU General Public License v2.0 5 votes vote down vote up
def listen(self, protocolFactory):
        """
        Implement L{IStreamServerEndpoint.listen} to listen for SSL on a
        TCP socket.
        """
        return defer.execute(self._reactor.listenSSL, self._port,
                             protocolFactory,
                             contextFactory=self._sslContextFactory,
                             backlog=self._backlog,
                             interface=self._interface) 
Example #5
Source File: endpoints.py    From Safejumper-for-Desktop with GNU General Public License v2.0 5 votes vote down vote up
def listen(self, protocolFactory):
        """
        Implement L{IStreamServerEndpoint.listen} to listen on a UNIX socket.
        """
        return defer.execute(self._reactor.listenUNIX, self._address,
                             protocolFactory,
                             backlog=self._backlog,
                             mode=self._mode,
                             wantPID=self._wantPID) 
Example #6
Source File: haproxy.py    From autopush with Mozilla Public License 2.0 5 votes vote down vote up
def listen(self, factory):
        """Implement IStreamServerEndpoint.listen to listen on TCP.

        Optionally configuring TLS behind the HAProxy protocol.

        """
        if self._ssl_cf:
            factory = TLSMemoryBIOFactory(self._ssl_cf, False, factory)
        proxyf = self.wrapper_factory(factory)
        return defer.execute(self._listen, self._port, proxyf, **self._kwargs) 
Example #7
Source File: endpoints.py    From learn_python3_spider with MIT License 5 votes vote down vote up
def listen(self, stdioProtocolFactory):
        """
        Implement L{IStreamServerEndpoint.listen} to listen on stdin/stdout
        """
        return defer.execute(self._stdio,
                             stdioProtocolFactory.buildProtocol(PipeAddress()),
                             reactor=self._reactor) 
Example #8
Source File: endpoints.py    From learn_python3_spider with MIT License 5 votes vote down vote up
def listen(self, protocolFactory):
        """
        Implement L{IStreamServerEndpoint.listen} to listen on a TCP
        socket
        """
        return defer.execute(self._reactor.listenTCP,
                             self._port,
                             protocolFactory,
                             backlog=self._backlog,
                             interface=self._interface) 
Example #9
Source File: endpoints.py    From learn_python3_spider with MIT License 5 votes vote down vote up
def listen(self, protocolFactory):
        """
        Implement L{IStreamServerEndpoint.listen} to listen for SSL on a
        TCP socket.
        """
        return defer.execute(self._reactor.listenSSL, self._port,
                             protocolFactory,
                             contextFactory=self._sslContextFactory,
                             backlog=self._backlog,
                             interface=self._interface) 
Example #10
Source File: endpoints.py    From learn_python3_spider with MIT License 5 votes vote down vote up
def listen(self, protocolFactory):
        """
        Implement L{IStreamServerEndpoint.listen} to listen on a UNIX socket.
        """
        return defer.execute(self._reactor.listenUNIX, self._address,
                             protocolFactory,
                             backlog=self._backlog,
                             mode=self._mode,
                             wantPID=self._wantPID) 
Example #11
Source File: endpoints.py    From python-for-android with Apache License 2.0 5 votes vote down vote up
def listen(self, protocolFactory):
        """
        Implement L{IStreamServerEndpoint.listen} to listen on a TCP socket
        """
        return defer.execute(self._reactor.listenTCP,
                             self._port,
                             protocolFactory,
                             backlog=self._backlog,
                             interface=self._interface) 
Example #12
Source File: endpoints.py    From python-for-android with Apache License 2.0 5 votes vote down vote up
def listen(self, protocolFactory):
        """
        Implement L{IStreamServerEndpoint.listen} to listen for SSL on a
        TCP socket.
        """
        return defer.execute(self._reactor.listenSSL, self._port,
                             protocolFactory,
                             contextFactory=self._sslContextFactory,
                             backlog=self._backlog,
                             interface=self._interface) 
Example #13
Source File: endpoints.py    From python-for-android with Apache License 2.0 5 votes vote down vote up
def listen(self, protocolFactory):
        """
        Implement L{IStreamServerEndpoint.listen} to listen on a UNIX socket.
        """
        return defer.execute(self._reactor.listenUNIX, self._address,
                             protocolFactory,
                             backlog=self._backlog,
                             mode=self._mode,
                             wantPID=self._wantPID) 
Example #14
Source File: tapestry.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def loadModel(self, path, request):
        """Load a model, for the given path and request.

        @rtype: L{Deferred}
        """
        from twisted.internet.defer import execute
        return execute(self.loadModelNow, path, request)