[Twisted-Python] Re: Adding callback to a Deferred that's already running?

Abe Fettig abe at fettig.net
Thu Aug 26 15:27:40 EDT 2004


David Bolen wrote:

> I'm not sure I follow the need for the extra deferred.  I would think
> that the following would work just as well:
> 
>     class XMLRPCResponseClass():
> 
>          def step1(self):
>             return self.db.runQuery(blah).addCallback(self.step2)
> 
>          def step2(self, result):
>              if result == 'yadda':
>                  return 'This bit works'
>              else:
>                  return self.db.runOperation(blah)

Ah, thanks - I didn't realize that would work.  I might be able to 
refactor some code now :-).

Abe





More information about the Twisted-Python mailing list