[Zope] Forcing Zope transaction commit
Bakhtiar A Hamid
bakhtiar.ahamid at gmail.com
Tue Jul 19 02:38:47 EDT 2005
On 7/19/05, David H <bluepaul at earthlink.net> wrote:
> 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?
>
you're playing with fire ;)
let zope handle the transaction
use <dtml-var sql_delimeter> to separate two or more sql calls
this way, if one of the call fails, the transaction will be aborted
gurus, correct me if i'm wrong, please
hth
> Thanks,
> David
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
--
http://myzope.kedai.com.my - my-zope org
More information about the Zope
mailing list