[mod_python] Question on Transactions

David Fraser davidf at sjsoft.com
Sun Feb 8 08:05:26 EST 2004

jalil wrote:

> I am looking for a clean way to create a transaction and use it across 
> multiple method calls. For example, method A calls B and C. B updates 
> a row successfully but C fails. I like A to abort changes made by B. I 
> thought about doing it by passing a connection created in A to B and C 
> so I can rollback if needed in A. But I don't like this approach.  I 
> like B to creates its own connection but join the transaction that 
> already started by A (or somehow get the same connection) or use its 
> own transaction context (or a new connection) if none there.
> I wonder how other people do this using Python.

Sounds like you need a single cursor that is opened in A and passed in
to B and C.
You should be able to use a single connection throughout your
application, then open a new cursor for each transaction...


More information about the Mod_python mailing list