[Zope] catching exceptions thrown by gadfly db
Micheál Healy
michael.healy@engitech.ie
Fri, 1 Nov 2002 14:10:40 -0000
This is a multi-part message in MIME format.
------=_NextPart_000_0020_01C281B0.754860A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi all,
I am trying to catch and handle an exception thrown by the gadfly db. =
My code is as follows:
<dtml-try>
<dtml-call =
expr=3D"sql_add_software(p_custName=3DcustName,swName=3DswName)">
<dtml-except>
An error occurred.
Error type: <dtml-var error_type>
Error value: <dtml-var error_value>
</dtml-try>
The error is thrown and caught (violation of a unique constraint), but =
it still inserts the row in the DB.
When I try to delete the identical rows, I get the following error:
Error, exceptions.ValueError: list.remove(x): x not in list
Any ideas?
TIA,
Miche=E1l Healy
------=_NextPart_000_0020_01C281B0.754860A0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi all,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I am trying to catch and handle an =
exception thrown=20
by the gadfly db. My code is as follows:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><dtml-try><BR> =
<dtml-call=20
expr=3D"sql_add_software(p_custName=3DcustName,swName=3DswName)"><BR>&=
lt;dtml-except><BR> =20
An error occurred.<BR> Error type: <dtml-var=20
error_type><BR> Error value: <dtml-var=20
error_value><BR></dtml-try></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The error is thrown and caught =
(violation of a=20
unique constraint), but it still inserts the row in the =
DB.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>When I try to delete the identical =
rows, I get the=20
following error:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><STRONG>Error, <EM>exceptions.ValueError</EM>:</STRONG> =
list.remove(x): x=20
not in list</DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Any ideas?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>TIA,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Miche=E1l =
Healy</FONT></DIV></BODY></HTML>
------=_NextPart_000_0020_01C281B0.754860A0--