[Zope-DB] Duplicate Insert

Chris Withers chris at simplistix.co.uk
Wed May 25 09:13:07 EDT 2005


Andy Yates wrote:
> What is the proper way to trap a duplicate insert.
> 
> I'm using Z MySQL.
> 
>  
> 
> try:
> 
>   context.duptest_qry()
> 
> except Exception, v:
> 
>   if v[0]==1062 :
> 
>     print "Duplicate Insert"

What happens if you put the above in an external method rather than a 
python script?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope-DB mailing list