mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-02 11:16:41 +00:00
18 lines
544 B
Python
18 lines
544 B
Python
|
|
||
|
from twisted.internet import defer
|
||
|
|
||
|
# utility wrapper for DeferredList
|
||
|
def _check_deferred_list(results):
|
||
|
# if any of the component Deferreds failed, return the first failure such
|
||
|
# that an addErrback() would fire. If all were ok, return a list of the
|
||
|
# results (without the success/failure booleans)
|
||
|
for success,f in results:
|
||
|
if not success:
|
||
|
return f
|
||
|
return [r[1] for r in results]
|
||
|
def DeferredListShouldSucceed(dl):
|
||
|
d = defer.DeferredList(dl)
|
||
|
d.addCallback(_check_deferred_list)
|
||
|
return d
|
||
|
|