On Wed, 2009-03-25 at 11:00 +0100, Pet wrote: > > Hi, > > > > thanks for example! > > In that way, I'm getting error: > > > > exceptions.AttributeError: MyProtocol instance has no attribute 'factory' > > > > How can MyProtocol access self.factory.dbcon? > > Ups! I didn't followed exactly your example and tried to access > self.factory.dbcon in __init__ of MyProtocol, so I've got an error. > If I access self.factory.dbcon in lineReceived it seems to work. But I > don't really understand, why can I access factory in lineReceived and > not in __init__. > > Pet
Hi Pet, You can simply look into the buildProtocol code of Factory for an explanation. This is the part where your protocol gets to be instantiated. HTH, Enrique _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python