[Twisted-Python] clients with parameters
Christopher Armstrong
radix at twistedmatrix.com
Thu Mar 20 00:13:15 EST 2003
On Wed, Mar 19, 2003 at 10:50:12PM -0500, Konrad Rokicki wrote:
> class AIMFactory(protocol.ClientFactory):
> protocol = AIM
> def __init__(self, nick, password):
> self.nick = nick
> self.password = password
> # etc
>
> class AIM(toc.TOCClient):
> def __init__(self):
> """ I don't have access to the factory here
> so I don't know these parameters...
> """
> toc.TOCClient.__init__(self, username, password)
>
You need to override the buildProtocol method of your Factory; it must
create and return the Protocol instance. See
twisted.protocols.toc.TOCFactory, for example.
--
Twisted | Christopher Armstrong: International Man of Twistery
Radix | Release Manager, Twisted Project
---------+ http://twistedmatrix.com/users/radix.twistd/
More information about the Twisted-Python
mailing list