[Zope] Forcing Zope transaction commit

David H bluepaul at earthlink.net
Tue Jul 19 00:14:26 EDT 2005


Hi list,

At times (it seems)  necessary to force a Zope transaction commit.  This 
might occur between two zSQL calls where the second depends on the 
first's *SQL* transaction's availability but the first has not yet been 
commited because the *Zope* transaction that includes both zSQL calls 
has not yet been commited.

I handled this with a call to an external script as below, eg

. zSql1()
. pyCommit() 
zSql2()
Publish new page

Here's pyCommit()

# ...............................................................
# Extenstion/pyCommit.py
# ...............................................................
from ZODB import FileStorage,DB

def commit( self ):
   t = get_transaction() # ZODB builtin
   if t:
      t.commit()
# ...............................................................

Thats it. And it solved my problem. Is there a reason why this is a bad 
idea, all things being equal?  A better way to do it, when needed?

Thanks,
David



More information about the Zope mailing list