Re: [Zope-DB] Duplicate Insert

2005-05-25 Thread Chris Withers

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
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


[Zope-DB] Duplicate Insert

2005-05-20 Thread Andy Yates








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"

 

I’ve tried this but Zope will not let me access v[0]
which is set to 1062 on dups.

 

Thanks!

 



Andy



 






___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db