[Zope] Catching Dababase IntegrityError

Kevin Carlson khcarlso@bellsouth.net
Fri, 18 Oct 2002 17:53:52 -0400


Look into <dtml-try> and <dtml-except>.  That should do what you need.

Kevin

-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Mike
Doanh Tran
Sent: Friday, October 18, 2002 4:37 PM
To: zope@zope.org
Subject: [Zope] Catching Dababase IntegrityError


Hi,

Does anyone know how to catch this data integrity error?
I was trying to give a more friendlier message than the Zope
error_message when someone accidentially enters a duplicate Primary Key
name of an existing record.

Error Type: IntegrityError
Error Value: (1062, "Duplicate entry 'Big Foot' for key 1")


I have tried the following in my <dtml-var standard_error_message> , but it
did not worked:

<dtml-if "error_type=='IntegrityError'">
   <h3>Duplicate Entry!</h3>
   <LI>This is a duplicate entry of an existing Database record. Please
rename your entry.
</dtml-if>

Thanks,

Mike

_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )