Package twisted :: Package internet :: Module defer :: Class DeferredList

[frames | no frames]

## Class DeferredList

    Deferred --+
               |
              DeferredList

I combine a group of deferreds into one callback.

I track a list of `Deferred`s for their callbacks, and make a single callback when they have all completed, a list of (success, result) tuples, 'success' being a boolean.

Note that you can still use a `Deferred` after putting it in a DeferredList. For example, you can suppress 'Unhandled error in Deferred' messages by adding errbacks to the Deferreds *after* putting them in the DeferredList, as a DeferredList won't swallow the errors. (Although a more convenient way to do this is simply to set the consumeErrors flag)

Method Summary
| ``__init__`(self, deferredList, fireOnOneCallback, fireOnOneErrback, consumeErrors)` Initialize a DeferredList.
| ``_cbDeferred`(self, result, index, succeeded)` (internal) Callback for when one of my deferreds fires.
| ``addDeferred`(self, deferred)` DEPRECATED
Inherited from Deferred
| ``__del__`(self)` Print tracebacks and die.
| ``__repr__`(self)`
| ``__str__`(self)`
| ``_continue`(self, result)`
| ``_debugInfo`(self)`
| ``_runCallbacks`(self)`
| ``_startRunCallbacks`(self, result)`
| ``addBoth`(self, callback, *args, **kw)` Convenience method for adding a single callable as both a callback and an errback.
| ``addCallback`(self, callback, *args, **kw)` Convenience method for adding just a callback.
| ``addCallbacks`(self, callback, errback, callbackArgs, callbackKeywords, errbackArgs, errbackKeywords, asDefaults)` Add a pair of callbacks (success and error) to this Deferred.
| ``addErrback`(self, errback, *args, **kw)` Convenience method for adding just an errback.
| ``arm`(self)` This method is deprecated.
| ``armAndCallback`(self, result)` Run all success callbacks that have been added to this Deferred.
| ``armAndChain`(self, d)` Chain another Deferred to this Deferred.
| ``armAndErrback`(self, fail)` Run all error callbacks that have been added to this Deferred.
| ``callback`(self, result)` Run all success callbacks that have been added to this Deferred.
| ``chainDeferred`(self, d)` Chain another Deferred to this Deferred.
| ``errback`(self, fail)` Run all error callbacks that have been added to this Deferred.
| ``pause`(self)` Stop processing on a Deferred until `unpause`() is called.
| ``setTimeout`(self, seconds, timeoutFunc, *args, **kw)` Set a timeout function to be triggered if I am not called.
| ``unpause`(self)` Process all callbacks made since `pause`() was called.

Class Variable Summary
`int` | `fireOnOneCallback` = 0
`int` | `fireOnOneErrback` = 0
Inherited from Deferred
`int` | `called` = 0
`int` | `debug` = 0
`int` | `default` = 0
`int` | `paused` = 0
`NoneType` | `timeoutCall` = None

Method Details

### __init__(self, deferredList, fireOnOneCallback=0, fireOnOneErrback=0, consumeErrors=0)
(Constructor)

Initialize a DeferredList.

  Parameters:
    `deferredList` - The list of deferreds to track.
    (type=`list` of `Deferred`s)
    `fireOnOneCallback` - (keyword param) a flag indicating that only one callback needs to be fired for me to call my callback
    `fireOnOneErrback` - (keyword param) a flag indicating that only one errback needs to be fired for me to call my errback
    `consumeErrors` - (keyword param) a flag indicating that any errors raised in the original deferreds should be consumed by this DeferredList. This is useful to prevent spurious warnings being logged.
  Overrides:
    `twisted.internet.defer.Deferred.__init__`

### _cbDeferred(self, result, index, succeeded)

(internal) Callback for when one of my deferreds fires.

### addDeferred(self, deferred)

DEPRECATED

Class Variable Details

### fireOnOneCallback

  Type:
    `int`
  Value:

        0

### fireOnOneErrback

  Type:
    `int`
  Value:

        0

Generated by Epydoc 2.0 on Sat May 15 20:07:55 2004 | http://epydoc.sf.net