[Zope-dev] BUG: ValueError while changing height of the template edit window

Casey Duncan casey@zope.com
Wed, 11 Dec 2002 09:18:10 -0500


On Wednesday 11 December 2002 03:43 am, Dmitry Vasiliev wrote:
> Casey Duncan wrote:
> > On Tuesday 10 December 2002 03:14 pm, Guido van Rossum wrote:
> >=20
> >>>Can we get the same patch without the generic "except:", please?
> >>>
> >>>the last thing I want is a database corruption caused by resizing th=
e
> >>>Edit box...
> >>
> >>Why would this particular except clause cause database corruption?
> >=20
> > I think Leonard is refering to catching ConflictErrors. However I don=
't=20
think=20
> > int() touches the database ;^).
>=20
> I saw "try: int() except:" pattern in many places through all the Zope=20
> code. I think catching ValueError only does the job, but then we should=
=20
> replace it in all the places. :-)

Nope, as Guido pointed out (and he should know ;^), Int can raise miriad=20
exceptions. not just ValueError.

IMO as long as the int is the *only* thing happening in the try block and=
 you=20
comment the bare except, then we are ok. Changing the except clause will =
only=20
introduce bugs.

-Casey