[Twisted-Python] Re: Considering Twisted for OfflineIMAP

Itamar Shtull-Trauring itamar at itamarst.org
Sat Jul 26 13:52:41 EDT 2003

On Sat, 26 Jul 2003 11:40:20 -0500
John Goerzen <jgoerzen at complete.org> wrote:
> I'd imagine that downloading a message would basically go like this:
> d = pool.acquireconnection()
> d.addCallback(select)
> d.addCallback(download)
> d.addCallback(releaseconnection)
> d.addCallback(returnresults)
> But this doesn't take into account errors, and it rather annoying to
> boot.

There's an addErrback. If you read the Deferred docs, you'll
eventually figure out how Deferreds match Python's exception handling
mechanism almost exactly, just with asynchronous APIs.

> One thought I had was to wait to import the reactor until I know what
> kind of UI I want.  That works OK as long as I continue using
> ConfigParser for my configuration.  If at some point I switch to using
> Twisted's config storage (I know it's there but I haven't looked at it
> yet), I suspect that could introduce a chicken-and-egg problem.

You can always stick to ConfigParser, and for your needs it may be

Itamar Shtull-Trauring    http://itamarst.org/
http://www.zoteca.com -- Python & Twisted consulting

More information about the Twisted-Python mailing list