[Twisted-Python] Re: Making DeferredList look like Deferred
Lenny G Arbage
alengarbage at yahoo.com
Mon Feb 6 11:05:01 MST 2006
Thomas HERVE therve at free.fr wrote:
> The behaviour you want is provided by the
> option 'consumeErrors' of DeferredList
> (you can see why here :
>
http://twistedmatrix.com/projects/core/documentation/howto/defer.html#auto8).
Aha, that's the piece I was missing! Thank you for
pointing it out.
Now, though, this leads me to one more question:
what if I want to wait until all the Deferreds have
fired (either err or callback), and only then call the
callback if all callbacks were fired, otherwise call
the errback?
To accomplish this, I'm currently just 'wrapping'
the DeferredList in a regular Deferred. It's callback
is always called on completion, so when it fires I
look at all the results given to the callback, and if
any have failed, raise an exception. Otherwise I
return a result.
This feels a little bit clunky, but I don't have a
good suggestion for improving it --
'fireOnErrbackAfterAllCompleted=True'?
Thanks,
Lenny
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Twisted-Python
mailing list