[Twisted-web] Class methods as callbacks/errbacks

A Desai ardesai at yahoo.com
Sun Jun 5 00:31:21 EDT 2011

I use a wrapper functions as follows to specify the callback argument of addCallback() and addErrback().

def reqConnLostCallbk(result, arg_self):

def reqConnLostErrbk(failure, arg_self):

... inside a class method
    d.addCallback(reqConnLostCallbk, self)
    d.addErrback(reqConnLostErrbk, self)

    def lost_conn(self):
        // cleanup

Is there an alternative and/or cleaner solution to specify a class method as a callback or errback?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20110604/7250a8da/attachment.htm 

More information about the Twisted-web mailing list