[Zope-DB] Re: gadlfy/commit
Dennis Allison
allison@shasta.Stanford.EDU
Tue, 11 Jun 2002 19:36:26 -0700 (PDT)
the behavior observed is in a fragment like
<dtml-try>
database-operation
<dtml-except>
....
</dtml-try>
The database-operation raises a non-unique key exception so control passes
to the <dtml-except>. The database is updated (non-unique keys be damned).
>From what you write, the <dtml-except> block has to raise and exception to
cause a rollback. That means the pattern is:
<dtml-try>
<dtml-try>
database-operation
<dtml-except>
<!-- here for exception for the operation -->
raise some-exception
</dtml-try>
<dtml-except>
<!-- report the problem -->
</dtml-try>
which seems a bit ugly, but if that's how it's done....
-d
On Tue, 11 Jun 2002, alan runyan wrote:
> it will automatically commit if the REQUEST completes without an Exception.
> if you want to abort the commit you will need to raise an Exception.
>
> ~runyaga
>
> > I have been trying to grok the commit/rollback mechanism for Gadfly. I
> can see
> > how to do it all from Python, but I don't see how to do it from <dtml ...
> > Is it a method call on the connection object? What's the sequence?
> begin,
> > data base operations, and finally either a commit or and abort.
>
>