ircLogBot (Was: [Twisted-Python] A Twisted Web Question....)

Jp Calderone exarkun at
Tue Jan 6 12:22:50 EST 2004

On Wed, Dec 31, 2003 at 01:29:59AM -0800, John Draper wrote:
> Hi, 

  Hi.  Your mail client has decided that you are responding to a message in
a thread about Twisted Web.  It probably did this because you had that
message selected when you told it to compose mail, or because you selected
reply rather than compose.  Since your message is not actually about Twisted
Web, this is confusing and undesirable.  In the future, please pay more
attention to what you are asking your mail client to do, so that it is
easier to find and understand the question you are asking.

> I call your attention to: 
> This was quoted in the Docs on the TwistedMatrix web site. 
> Persistent Data in the Factory 
> Since the Protocol instance is recreated each time the connection is 
> made, the client needs some way to keep track of data that should be 
> persisted. In the case of (LogBot.log() just logs the 
> data to the file object stored in LogBot.file) 
> it references a LogBot.log() call....   but I checked in 
> and there is NO log() 
> method,  nor is there one in any of the other classes it inherits from. 
> Would it be too much of a bother if I were to ask anyone about this 
> descrepancy? 

  Not at all.  It is true that the class has no log method, however, if you
examine the connectionMade method:

    def connectionMade(self):
        self.logger = MessageLogger(open(self.factory.filename, "a"))
        self.log = self.logger.log
        self.log("[connected at %s]" % time.asctime(time.localtime(time.time())))

  you will see that instances of the class bind method from a *different* to
that name, allowing users of the class to use the method as if it were
defined by the LogBot class itself.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : 

More information about the Twisted-Python mailing list