[Twisted-Python] From factory to protocol

Thomas Heller theller at python.net
Thu Feb 13 09:08:44 EST 2003

Is it somehow possible to get to the protocol from the factory?

My code is structured this way:

I create instances of a Factory (sub)class, these (in their __init__
method), call reactor.connectTCP(address, port, self).

The protocol (LineReceiver) subclass hands data it receives to the
factory instance via self.factory.handle_data(), which parses the data
and calls methods in the 'models' they control.

Now, the models I have sometimes create events which must be sent to the
protocol again, but how can I access the actual protocol instance
from the Factory?



More information about the Twisted-Python mailing list