[Twisted-web] Problem using formless with a deferred value
Tommi Virtanen
tv at twistedmatrix.com
Tue Nov 9 03:23:42 MST 2004
Gavrie Philipson wrote:
>Am I doing something wrong here, or is this a bug in Twisted or Nevow?
>
>
The former.
>class Implementation(object):
> __implements__ = IMyForm,
>
> def bar(self, baz):
>
> def _cb():
> print "Done!"
> return "hello..."
>
> print "baz!", baz
>
> d = defer.Deferred()
> reactor.callLater(0, _cb)
>
> return d
>
>
Your _cb is in no way connected to the Deferred.
Try
def bar(self, baz):
def _cb(result):
print "Done!", result
return "hello..."
print "baz!", baz
d = defer.Deferred()
d.addCallback(_cb)
reactor.callLater(0, d.callback, 42)
return d
More information about the Twisted-web
mailing list