[Zope-DB] SQL exception handling questions

Luis Mariano Luporini lluporini@yahoo.com.ar
Mon, 17 Mar 2003 13:28:43 -0300


Thanks for your quick response.

Now, I've the following script:

# Start

import psycopg

try:
    context.sql_insertar_estadistica(equipo=eq, fecha=fe, 
concepto_1=cn1, concepto_2=cn2, concepto_3=cn3, concepto_4=cn4, valor=vl)
except psycopg.IntegrityError:
    print "Error"

print "Finalizado"

return printed

# End

And when I tried to test it, Zope asks me for user/pass (I'm in the zmi 
with admin user logged before testing) and then gives me:

*Error Type: Unauthorized*
*Error Value: You are not allowed to access IntegrityError in this context*

Do you know what it could be?

Thanks again.

Luis.

Andrew Veitch wrote:

>First off you need to import the exceptions:
>
>Import psycopg
>
>Then catch with something like:
>
>try:
>  result=self.sql.search(query)
>except psycopg.IntegrityError:
>  doSomething()
>
>Hope that helps
>
>Andrew
>
>
>_______________________________________________
>Zope-DB mailing list
>Zope-DB@zope.org
>http://mail.zope.org/mailman/listinfo/zope-db
>
>  
>


------------
¡Internet GRATIS es Yahoo! Conexión!
Usuario "yahoo", contraseña "yahoo". 
Desde Buenos Aires, 4004-1010.
Otras ciudades: http://conexion.yahoo.com.ar/avanzados.html