[Twisted-Python] Screen clearing in the Manhole
Peter Westlake
peter.westlake at pobox.com
Tue Aug 25 10:27:34 MDT 2015
I'm making a manhole service in the usual way:
class PF(ServerProtocol): def protocolFactory(*a, **kw):
return manhole.Manhole(namespace)
realm = manhole_ssh.TerminalRealm() realm.chainedProtocolFactory = PF
mh_portal = portal.Portal(realm) mh_portal.registerChecker(checker)
manhole_service = TCPServer(0, manhole_ssh.ConchFactory(mh_portal))
manhole_service.startService()
and I'd like to print a message when the terminal is opened. This
change does it:
class PF(ServerProtocol): def protocolFactory(*a, **kw):
class Manhole(manhole.Manhole): def connectionMade(self):
super(Manhole, self).connectionMade()
self.terminal.write('Hello') return
manhole.Manhole(namespace)
and so does this version, which is better because
t.c.i.i.ServerProtocol.connectionMade says it is the place to
write messages:
class PF(ServerProtocol): def protocolFactory(*a, **kw):
return manhole.Manhole(namespace)
def connectionMade(self): ServerProtocol.connectionMade(self)
self.write('Hello')
But in both cases, after the message the screen is cleared by what looks
like a form feed, and another prompt is printed. So far I can't find
where in the code this happens. Is there a way to print a message and
not have it scrolled off the screen?
Thanks,
Peter.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20150825/72e24d69/attachment.html>
More information about the Twisted-Python
mailing list