[Twisted-Python] Deferred execution, timeouts, and unhandled exceptions

Bob Ippolito bob at redivi.com
Fri Jan 17 19:04:01 EST 2003

I've noticed that there isn't really a good/standard way to do timeouts 
(without bad things happening) or cancel deferreds in Twisted [without 
subclassing everything you use, which isn't good in my book].

In the attached code sample (and log, so you don't need to run it to 
see its output), I demonstrate the problem, a quick-fix temporary 
solution (to prevent unhandleable exceptions from being raised), and a 
longer term proposed convention for refactoring existing classes to 
take advantage of this new functionality.

As radix mentioned, my proposed solution does make the meaning of 
errback somewhat ambiguous.  However if you add a new 
CancelledOperation exception to deferred, and addCanceller/cancel 
methods (addCanceller = addErrback, cancel = errback) then it'd be 
pretty transparent.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: deferred.py
Type: application/octet-stream
Size: 3343 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20030117/b1103e3a/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deferred.log
Type: application/octet-stream
Size: 2426 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20030117/b1103e3a/attachment-0001.obj 

More information about the Twisted-Python mailing list