[Twisted-Python] Conch/insults -- using HistoricRecvLine

Bjoern Schliessmann chronoss at gmx.de
Sat Dec 8 19:21:27 EST 2007


I'm using a "standard" Twisted setup here: a ServerFactory which has
basic.LineReceiver subclass as protocol for handling connections;
I'm using methods like connectionMade and lineReceived.

Now I tried the example on HistoricRecvLine from Twisted Conch and I
like it. I tried my protocol to subclass HistoricRecvLine directly
instead of basic.LineReceiver, but the server won't work anymore
(it complains about not finding certain methods as soon as a
connection comes in). So HistoricRecvLine doesn't seem to be
compatible to standard Core protocols.

I had a closer look at the demo_recvline.py example and, besides
under ten lines of real code defining functional stuff, I saw a
real mess of wrapper code. Several different classes are used to
hook up the DemoRecvLine class into the ServerFactory. (This simple
example is, IMHO, a huge difference to the elegance of simple
Twisted Core examples.)

Those wrapper classes are documented in a way that you don't
understand what one class does unless you understand what some few
other classes and interfaces do. Those others are documented in a
similar way ;) There is one tutorial for conch which is in my view
completely unrelated.

No matter what, I tried to adapt and/or wrap my
ex-basic.LineReceiver-and-now-HistoricRecvLine subclass in a way
that I can hook it up to my ServerFactory class, but to no avail
for hours. That's why I'm asking here. Could you please tell me
what exactly I need to do to "convert" my new HistoricRecvLine
subclass in a way that ServerFactory will accept it? Or is there
even a simpler way to get basic readline-like functionality in
Twisted? Because that's what I'm aiming at.



BOFH excuse #403:

Sysadmin didn't hear pager go off due to loud music from bar-room

More information about the Twisted-Python mailing list