[Twisted-Python] Making DeferredList look like Deferred

Jean-Paul Calderone exarkun at divmod.com
Fri Feb 3 16:08:54 EST 2006


On Fri, 3 Feb 2006 12:18:56 -0800 (PST), Lenny G Arbage <alengarbage at yahoo.com> wrote:
>
>(The reason I can't just return the DeferredList, as I
>understand, is that its callback is *always* invoked,
>even if we leave each of the Deferred's errbacks
>unhooked and let them trickle up into DeferredList's
>addErrback callable.  In the case of a caller who
>expects the returned deferred to be a regular
>deferred, it would not be expected to have *both* its
>callback and errback invoked).

DeferredList has *either* callback *or* errback called on it, just like any Deferred.  If you just give it a list of Deferreds, it will always have its callback method invoked and never have its errback method invoked, regardless of whether any of the Deferreds it was constructed with fail.  However, if you pass a true value for fireOnOneErrback when constructing your DeferredList, any Deferred which errbacks will cause the DeferredList to errback; in this case it will never callback.

Does that help?

Jean-Paul




More information about the Twisted-Python mailing list