[Twisted-Python] Deferred database transaction confusion

Itamar Shtull-Trauring itamar at itamarst.org
Wed Aug 13 08:23:53 EDT 2003


On Wed, 13 Aug 2003 03:04:17 -0700
"Lucas Taylor" <lucas at lucaserve.com> wrote:

> Now here's where I'm stuck. I've got a rudimentary idea of how I will
> be chaining callbacks to the deferred results of my db interactions,
> and once complete the data will be sent to the terminal. And the
> registered errbacks need to be able to rollback if necessary. But how
> do I get the protocol handler to access the database connection to
> issue the commit/rollback?

You don't. The commit/rollback happens before the Deferred's callbacks
get called. In fact, the commit/rollback are done for you automatically
- if you runInteraction the operations you did will be committed if they
succeeded or rolled back if an exception was raised in the interaction
function.

-- 
Itamar Shtull-Trauring    http://itamarst.org/
Available for Python & Twisted consulting




More information about the Twisted-Python mailing list