Class methods as callbacks/errbacks

A Desai <[email protected]>
Newsgroups gmane.comp.python.twisted.web
Message-ID <[email protected]>
I use a wrapper functions as follows to specify the callback argument of addCallback() and addErrback().

def reqConnLostCallbk(result, arg_self):
    arg_self.lost_conn()

def reqConnLostErrbk(failure, arg_self):
    arg_self.lost_conn()


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

    def lost_conn(self):
        // cleanup
        pass

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

-Arun

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.