[Zope-DB] Managing transactions manually
dieter at handshake.de
Fri Jan 30 14:39:18 EST 2004
Andrius Armonas wrote at 2004-1-29 19:16 +0200:
>What I need is manually start transaction while rendering some page (for
>example select ... for update), continue that transaction while
>rendering some other pages and then commit or rollback that transaction.
>How that should be done in Zope if it commits transactions
This is not supported by Zope (and I think this is good).
You can implement your own transaction handling by not
using Zope's database adapters and Z SQL Methods
but access the database directly (via "MySQL-Python", the
MySQL adapter for Python).
Be warned however, that it will not be easy to keep transaction
state consistent. Asume, e.g., that some internet user
started a transaction but leaves your site before the transaction
is committed. Unless, you implement some timeout mechanism,
the transaction is never finished and can block parts of your
The usual approach to your kind of problems is to accumulate
all necessary data in a session object and after all
data has been collected, the database is updated in a single
one request transaction.
Consider whether such an approach can work for you, too.
More information about the Zope-DB