Package twisted :: Package internet :: Module defer |
[show private | hide private]
[frames | no frames]

## Module twisted.internet.defer

Support for results that aren't immediately available.

API Stability: stable

Maintainer: Glyph Lefkowitz<mailto:glyph@twistedmatrix.com>

Classes
`Deferred` | This is a callback which will be put off until later.
`DeferredList` | I combine a group of deferreds into one callback.
`_nothing` |

Exceptions
`AlreadyCalledError` |
`TimeoutError` |
`AlreadyArmedError` |

Function Summary
| `succeed(result)`
| `fail(result)`
| ``gatherResults`(deferredList)` Returns list with result of given Deferreds.
| ``execute`(callable, *args, **kw)` Create a deferred from a callable and arguments.
| `logError(err)`
| ``maybeDeferred`(deferred, func, *args, **kw)` Invoke a function that may or may not return a deferred.
| `passthru(arg)`
| `timeout(deferred)`
| `_parseDListResult(l)`

Variable Summary
`int` | `FAILURE`
`int` | `SUCCESS`
`_Feature` | `nested_scopes`

Function Details

### execute(callable, *args, **kw) Create a deferred from a callable and arguments. Call the given function with the given arguments. Return a deferred which has been fired with its callback as the result of that invocation or its errback with a Failure for the exception thrown.

### gatherResults(deferredList) Returns list with result of given Deferreds. This builds on `DeferredList` but is useful since you don't need to parse the result for success/failure. Parameters: `deferredList` (type=`list` of `Deferred`s)

### maybeDeferred(deferred, func, *args, **kw) Invoke a function that may or may not return a deferred. Call the given function with the given arguments. If the returned object is a Deferred, chain it with the `deferred` parameter, otherwise if it is not a `Failure`, pass it to `deferred.callback`. If a `Failure` is returned, pass it to `deferred.callback`, and do likewise for any exception raised after wrapping it in a `Failure`. If `deferred` is `None`, a new `Deferred` is instantiated and used instead. This `Deferred` is returned. API Stability: Unstable

Variable Details

    ### FAILURE Type: `int` Value:
        0

    ### nested_scopes Type: `_Feature` Value:
        _Feature((2, 1, 0, 'beta', 1), (2, 2, 0, 'alpha', 0), 16)

    ### SUCCESS Type: `int` Value:
        1

Generated by Epydoc 1.1 on Thu May 8 13:18:25 2003 | http://epydoc.sf.net