[Zope] adding properties trough pythonscript
massimop at users.berlios.de
massimop at users.berlios.de
Mon Oct 18 06:00:57 EDT 2004
On Sun, 2004-10-17 at 22:44 +0200, Dieter Maurer wrote:
> massimop at users.berlios.de wrote at 2004-10-16 12:23 +0200:
> > ...
> >> Do not use "try: ... except:...". It is dangerous. It can easily
> >> lead to ZODB inconsistencies...
> >
> >not exactly good news to me....
> >
> >can you point out some document explaining this?
>
> It follows from common sense (and therefore need no documentation ;-)
>
> Python's exceptions are abortive: as soon an exceptin is raise,
> the normal flow of control is aborted.
>
> When you have modified persistent state before the exception occured,
> the transaction must usually be aborted, to get the modifications
> reverted. If instead, the transaction is committed, the (often)
> partial change is made persistent.
>
> Usually, the Zope framework does this for you.
> However, when you catch an exception, the framework may
> not learn about the problem and commit rather than abort.
>
> As I wrote, this can easily lead to corruption of persistent
> data.
yes, it looks sound...:)
thanks
massimo
More information about the Zope
mailing list