[Twisted-Python] Passing parameters to Adapter

Dear twisted developers, I have a sshdaemon based on sshsimpleserver.py which works great. But I now want to pass a command line argument to the EchoProtocol. How can I do this? In this case I would like to pass the 'options.test' option to my protocol. if __name__ == '__main__': parser = optparse.OptionParser() parser.add_option('-p', '--port', action = 'store', type = 'int', dest = 'port', default = 1235, help = 'server port') parser.add_option('-t', '--test', action = 'store', type = 'string', dest = 'test', default = '123') (options, args) = parser.parse_args() components.registerAdapter(ExampleSession, ExampleAvatar, session.ISession) [...] reactor.listenTCP(options.port, ExampleFactory()) reactor.run() Since the session instance is created by the factory, I can't seem to be able to pass additional args to e.g. the constructor. Thanks a lot! Fabian ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
participants (1)
-
Fabian Sturm