Exemplo n.º 1
0
 def add_circuit_listener(self, icircuitlistener):
     """
     Adds a new instance of :class:`txtorcon.interface.ICircuitListener` which
     will receive updates for all existing and new circuits.
     """
     listen = ICircuitListener(icircuitlistener)
     for circ in self.circuits.values():
         circ.listen(listen)
     self.circuit_listeners.append(listen)
Exemplo n.º 2
0
    def test_listener_mixin(self):
        listener = CircuitListenerMixin()
        from zope.interface.verify import verifyObject
        self.assertTrue(verifyObject(ICircuitListener, listener))

        # call all the methods with None for each arg. This is mostly
        # just to gratuitously increase test coverage, but also
        # serves to ensure these methods don't just blow up
        for (methodname, desc) in ICircuitListener.namesAndDescriptions():
            method = getattr(listener, methodname)
            args = [None] * len(desc.positional)
            method(*args)
Exemplo n.º 3
0
 def add_circuit_listener(self, icircuitlistener):
     listen = ICircuitListener(icircuitlistener)
     for circ in self.circuits.values():
         circ.listen(listen)
     self.circuit_listeners.append(listen)