[Zope] Catching Dababase IntegrityError

Mike Doanh Tran mtran@shufflemasterrd.com
Fri, 11 Oct 2002 11:15:25 -0600


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 Tran
Shuffle Master Inc.