Esempio n. 1
0
class TwistedCmdBackend(LineReceiver):
    """Read commands from stdin, parse and forward to the Controller.

    FIXME: Use Twsited's Manhole for handling input (history,...)
    See:
        /usr/lib64/python2.5/site-packages/twisted/conch/stdio.py - Example
        /usr/lib64/python2.5/site-packages/twisted/conch/insults/insults.py
        /usr/lib64/python2.5/site-packages/twisted/conch/recvline.py
        /usr/lib64/python2.5/site-packages/twisted/conch/manhole.py
    """

    from os import linesep as delimiter

    #__ON_KILLED = staticmethod(lambda: reactor.stop())

    #def __init__(self, killer=None):
    #    CmdOnlyBackend.__init__(self, killer or self.__ON_KILLED)

    def __init__(self, killer=None):
        self.backend = CmdOnlyBackend()

    def connectionMade(self):
        self.backend.connection_made()

    def lineReceived(self, line):
        try:
            self.backend.line_received(line)
        except StopIteration:
            reactor.stop()
Esempio n. 2
0
class TwistedCmdBackend(LineReceiver):
    """Read commands from stdin, parse and forward to the Controller.

    FIXME: Use Twsited's Manhole for handling input (history,...)
    See:
        /usr/lib64/python2.5/site-packages/twisted/conch/stdio.py - Example
        /usr/lib64/python2.5/site-packages/twisted/conch/insults/insults.py
        /usr/lib64/python2.5/site-packages/twisted/conch/recvline.py
        /usr/lib64/python2.5/site-packages/twisted/conch/manhole.py
    """

    from os import linesep as delimiter

    #__ON_KILLED = staticmethod(lambda: reactor.stop())

    #def __init__(self, killer=None):
    #    CmdOnlyBackend.__init__(self, killer or self.__ON_KILLED)

    def __init__(self, killer=None):
        self.backend = CmdOnlyBackend()

    def connectionMade(self):
        self.backend.connection_made()

    def lineReceived(self, line):
        try:
            self.backend.line_received(line)
        except StopIteration:
            reactor.stop()
Esempio n. 3
0
 def __init__(self, killer=None):
     self.backend = CmdOnlyBackend()
Esempio n. 4
0
 def __init__(self, killer=None):
     self.backend = CmdOnlyBackend()