[Twisted-Python] Re: If lineReceived returns deferred, then connection is dropped and this deferred given as error message

Marcin Kasperski Marcin.Kasperski at softax.com.pl
Tue Oct 31 11:15:36 EST 2006

One more observation after looking at twisted code:

twisted/protocols/basic.py funtion LineReceiver.dataReceived contains sth like that:

           why = self.lineReceived(line)
           if why or self.transport and self.transport.disconnecting:
                    return why

As this is WITHIN the loop, we see why returning deferred (or anything true)
from lineReceived breaks processing.

I did not search further but it seems somebody is using convention that
if lineReceived (and maybe dataReceived) returns something, then this is
an error. Why not exception??? And, is it possible to patch it somehow so 
lineReceived function could be unit-tested?

More information about the Twisted-Python mailing list