How to use the circuits.core.handler function in circuits

To help you get started, we’ve selected a few circuits examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github circuits / circuits / tests / core / test_call_wait_timeout.py View on Github external
    @handler('hello')
    def _on_hello(self):
        return 'hello'
github circuits / circuits / circuits / protocols / line.py View on Github external
    @handler("read")
    def _on_read(self, *args):
        if len(args) == 1:
            # Client read
            data, = args
            lines, self.buffer = self.splitter(data, self.buffer)
            [self.fire(line(x)) for x in lines]
        else:
            # Server read
            sock, data = args
            lines, buffer = self.splitter(data, self.getBuffer(sock))
            self.updateBuffer(sock, buffer)
            [self.fire(line(sock, x)) for x in lines]
github circuits / circuits / circuits / web / servers.py View on Github external
    @handler("write")
    def write(self, sock, data):
        self.fire(write(data))
github realXtend / tundra / src / Application / PythonScriptModule / pymodules_old / circuits / net / sockets.py View on Github external
    @handler("started", filter=True, target="*")
    def _on_started(self, component, mode):
        if self._poller is None:
            self._poller = self._PollerComponent()
            self._poller.register(self.root)
            self._poller.addReader(self, self._sock)
            return True
github circuits / circuits / circuits / net / sockets.py View on Github external
    @handler("ready")
    def ready(self, component):
        if self._poller is not None and self._connected:
            self._poller.addReader(self, self._sock)
github circuits / circuits / circuits / web / servers.py View on Github external
    @handler("signal")
    def _on_signal(self, *args, **kwargs):
        """signal Event Handler"""

        self.fire(close())
        Timer(3, terminate()).register(self)
github circuits / circuits / circuits / web / http.py View on Github external
    @handler("request_success")  # noqa
    def _on_request_success(self, e, value):
        """
        Handler for the ``RequestSuccess`` event that is automatically
        generated after all handlers for a
        :class:`~circuits.web.events.Request` event have been invoked
        successfully.

        :param e: the successfully handled ``Request`` event (having
            as attributes the associated
            :class:`~circuits.web.wrappers.Request` and
            :class:`~circuits.web.wrappers.Response` objects).
        :param value: the value(s) returned by the invoked handler(s).

        This handler converts the value(s) returned by the
        (successfully invoked) handlers for the initial ``Request``
        event to a body and assigns it to the ``Response`` object's
github circuits / circuits / circuits / web / client.py View on Github external
    @handler("connect", priority=1)
    def connect(self, event, host=None, port=None, secure=None):
        if not self._transport.connected:
            self.fire(connect(host, port, secure), self._transport)

        event.stop()
github circuits / circuits / circuits / net / sockets.py View on Github external
    @handler("started", filter=True, target="*")
    def _on_started(self, component, mode):
        if self._poller is None:
            self._poller = Poller().register(self)
            self.push(Ready(self), "ready", self.channel)
            return True
github circuits / circuits / circuits / io / file.py View on Github external
    @handler("ready")
    def _on_ready(self, component):
        self.fire(_open(), self.channel)