Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
the 2nd chained deferred receives None as a result
#!/usr/bin/env python
# http://stackoverflow.com/q/13634785
from twisted.internet import defer
class Baz:
def __init__(self):
self.resultD = defer.Deferred()
def fooMe(self, name):
d = defer.Deferred()
self.resultD.addCallback(d.callback) # or resultD.chainDeferred(d)
@d.addCallback
def f(result):
print "fooMe(%s) got: %s" % (name, result,)
assert result is not None
return result
return d
defer.Deferred.debug = True # get more info in traceback
b = Baz()
b.fooMe("one")
b.fooMe("two")
b.resultD.callback("result")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.