[Twisted-Python] DeferredList and errback

Andrew Bennetts andrew-twisted at puzzling.org
Sat Jul 13 12:55:49 EDT 2002


DeferredList is handy, but it isn't quite what I need for FTPClient.

Here's my use-case:  A file is deemed to be downloaded by FTPClient when
both the 226 transfer complete message is received on the control
connection, *and* the data connection is closed.

DeferredList takes care of this nicely, so long as it works.  In the case
where the control connection immediately returns an error (e.g. file not
found), one errback will be called and the other Deferred will never be
called either way, effectively hanging the client.  (I've got a testcase for
this, but I haven't checked it in yet because having FTP tests passing is a
novelty that I don't want to take away from people ;)

So ideally I want DeferredList (or something like DeferredList) to wait for
all callbacks, as it currently does, but fire its errback as soon as any of
its Deferreds fires an errback.  Later errbacks and callbacks would be
ignored.

I realise I'm probably too late to get this into 0.19.0, but I'm wondering
what the right way to provide this is:
  - new class in defer.py (what would it be called?),
  - change the behaviour of DeferredList to do what I want, or
  - add a flag to the current DeferredList so it can do either behaviour?

-Andrew.





More information about the Twisted-Python mailing list