[ZODB-Dev] RE: [Zope-Annce] ZODB 3.2.4 release candidate 1released
Tim Peters
tim at zope.com
Thu Sep 9 16:05:49 EDT 2004
[Dieter Maurer]
> The commit is assumed in an outer block to be executed sometime after the
> shown code.
>
> Raising the exception is assumed not to occur always (but due to some
> bug.
>
> Let's cast it into a slightly different picture:
>
> try:
> try:
> # perform modifications on persistent state
> except ...
> # do something that does not abort the transaction
> # and does not raise an exception
> ...
> commit()
> except:
> abort()
> ...
>
> Should the "perform modifications" result in any exception, then the
> exception is likely to leave the state inconsitent. Catching the
> exception causes "commit" to be called which makes the inconsistent state
> persistent.
OK, that's clear enough. I suggest not writing code that way <wink>.
More information about the ZODB-Dev
mailing list