[Twisted-Python] Simplifying my StatusMonitor

Andrew Bennetts andrew-twisted at puzzling.org
Fri Jul 18 00:27:30 EDT 2003


On Fri, Jul 18, 2003 at 11:42:04AM +0800, Wari Wahab wrote:
> 
> PS: To twisted developers, why can't I do
> d = StatusMonitor().checkFor200OK('http://www.bbnet.ca/')
> d.addCallback(StatusMonitor().checkFor200OK, 'http://www.yahoo.com')
> 
> The reactor will be stuck after the bbnet.ca call.

Probably because the first argument to a callback is the result of the
previous call back.  Perhaps this will do what you want:


d = StatusMonitor().checkFor200OK('http://www.bbnet.ca/')
d.addCallback(lambda result, url: StatusMonitor().checkFor200OK(url), 
              'http://www.yahoo.com')

-Andrew.





More information about the Twisted-Python mailing list