[Zope-CMF] Re: [CMF-checkins] CVS: CMF/CMFCore -
FSMetadata.py:1.5
Tres Seaver
tseaver@zope.com
23 Jun 2003 15:00:03 -0400
On Mon, 2003-06-23 at 14:18, Florent Guillaume wrote:
> On Mon, 2003-06-23 at 19:37, Tres Seaver wrote:
> > On Mon, 2003-06-23 at 13:08, Andy McKay wrote:
> > > > I'd try to recreate it if I knew the specifics of the errors you
> > > > encountered. As it is, I'll mark on my todo list to try and revisit
> > > > this. I hate bare excepts.
> > >
> > > There's a lot of them in Zope code to hate :) I'll try to recreate and
> > > track down the *real* problem now I have slightly more time.
> >
> > Bare excepts in Zope are particularly nasty, because they swallow
> > ConflictErrors; in any currently-released Zope, such ill-mannered
> > behavior can lead to transactions which commit using inconsistent data.
> >
> > I would vote for disabling 'except:' altogether in TTW code, and would
> > make 'ConflictError' and all its bases inaccessible from TTW code as
> > well (there is *no way* TTW code can know enough to do the Right Thing
> > in the face of a conflict error; most filesystem code can't either, but
> > we "trust" those authors :( ).
>
> Except for TTW code that wishes to do:
> try:
> somestuff()
> except ConflictError:
> raise
> except:
> raise ValueError("check your values bob")
>
> But that's still quite bad.
Right, because *every* bare except in TTW code should do that. I just
finished a jihad in co-developed code where we went through and added
such tourniquets, which sucked a lot. I would rather have TTW code be
*unable* to catch a bare 'except:' at all.
Tres.
--
===============================================================
Tres Seaver tseaver@zope.com
Zope Corporation "Zope Dealers" http://www.zope.com