[Zope-dev] bare exceptions

Leonardo Rochael Almeida leo@hiper.com.br
04 Oct 2002 17:58:43 -0300


This is a MIME-formatted message.  If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_spitfire-16162-1033765124-0001-2
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

On Fri, 2002-10-04 at 16:37, Leonardo Rochael Almeida wrote:
> 
> I'm testing a fix for the TALES case along the lines of what Casey
> sugested and will report back with results.
> 

And here it is. TALES actually had a slot for my change, go figure :-)

as for PluginIndex/common/UnIndex.py, I'd like to propose the following
rule, before I attempt a fix:

No bare 'except:' shall silently ingore it's exception and proceed.
Outside of ZPublisher, any bare 'except:' MUST raise either the original
exception or another one. Inside of ZPublisher it's too dark to read.

What do you think?

Cheers, Leo

PS: in PageTemplates/TALES.py there's another bare 'except:' in the
Iterator class, I suggest it be changed to include a self._nocatch
mechanism just like the Context class in that same file. What do you
think?

-- 
Ideas don't stay in some minds very long because they don't like
solitary confinement.


--=_spitfire-16162-1033765124-0001-2
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Description: Patch for
	lib/python/Products/PageTemplates/Expressions.py
Content-Disposition: inline; filename=tales-conflicterror.patch

--- lib/python/Products/PageTemplates/Expressions.py-orig       2002-10-04 =
17:26:31.000000000 +0000
+++ lib/python/Products/PageTemplates/Expressions.py    2002-10-04 17:26:38=
.000000000 +0000
@@ -24,6 +24,7 @@
      TALESError, Undefined, Default, _parse_expr
 from string import strip, split, join, replace, lstrip
 from Acquisition import aq_base, aq_inner, aq_parent
+from ZODB.POSException import ConflictError
=20
=20
 _engine =3D None
@@ -33,7 +34,7 @@
         from PathIterator import Iterator
         _engine =3D Engine(Iterator)
         installHandlers(_engine)
-        _engine._nocatch =3D (TALESError, 'Redirect')
+        _engine._nocatch =3D (TALESError, 'Redirect', ConflictError)
     return _engine
=20
 def installHandlers(engine):

--=_spitfire-16162-1033765124-0001-2--