Package twisted :: Package internet :: Module defer
[frames | no frames]

Module twisted.internet.defer

Support for results that aren't immediately available.

API Stability: stable

Maintainer: Glyph Lefkowitz
Classes
_nothing  
Deferred This is a callback which will be put off until later.
DeferredList I combine a group of deferreds into one callback.

Exceptions
AlreadyArmedError  
AlreadyCalledError  
TimeoutError  

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

Variable Summary
int FAILURE = 0                                                                     
int SUCCESS = 1                                                                     

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, fireOnOneErrback=0)

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 Deferreds)

maybeDeferred(f, *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, return it. If the returned object is a Failure, wrap it with fail and return it. Otherwise, wrap it in succeed and return it. If an exception is raised, convert it to a Failure, wrap it in fail, and then return it.
Parameters:
f - The callable to invoke
           (type=Any callable)
args - The arguments to pass to f
kw - The keyword arguments to pass to f
Returns:

The result of the function call, wrapped in a Deferred if necessary.

API Stability: Unstable
           (type=Deferred)

Variable Details

FAILURE

Type:
int
Value:
0                                                                     

SUCCESS

Type:
int
Value:
1                                                                     

Generated by Epydoc 2.0 on Wed Feb 25 07:37:05 2004 http://epydoc.sf.net