[Twisted-Python] Doubt regarding registerAdapter in sshsimpleserver.py
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Fri Jun 24 11:57:19 EDT 2011
On 12:37 am, anshul.singhle at gmail.com wrote:
>Hi,
>I'm a Twisted newbie and I'm working on a custom ssh daemon for serving
>git.
>I happened to read one of the example files sshsimpleserver.py at *
>http://twistedmatrix.com/projects/conch/documentation/examples/* . At
>line
>93 ExampleSession is registered as an Adapter for ExampleAvatar
>adapting it
>to session.ISession. As i understand, to actually do the adaptation a
>call
>like ISession(ExampleAvatar) has to be done (?). This call hasn't been
>done.
It's more like ISession(ExampleAvatar()) - the instance is adapted, not
the class.
Conch does this in SSHSession in a few places:
http://twistedmatrix.com/trac/browser/tags/releases/twisted-11.0.0/twisted/conch/ssh/session.py#L23
So using SSHSession is the main way to have your ISession adapter make a
difference.
Jean-Paul
More information about the Twisted-Python
mailing list