[Twisted-Python] db connections
petshmidt at googlemail.com
Sat Mar 28 04:35:05 EDT 2009
On Sat, Mar 28, 2009 at 2:32 AM, Enrique Samson Jr. <enriquejr at gmail.com> wrote:
> 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__.
> 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
thanks for a hint. I'll look into that closer. Twisted is like a black
box for me right now. However, I've managed to write a useful
Client-Server App :)
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
More information about the Twisted-Python