[Zope-DB] SQL exception handling questions

Luis Mariano Luporini lluporini@yahoo.com.ar
Mon, 17 Mar 2003 17:01:59 -0300


Thanks again Andrew, I'll try to learn how to do it.

Luis.

Andrew Veitch wrote:

>Sorry I was assuming you were writing a Python file system product.
>
>Zope scripts restrict what you can import for security reasons.
>
>The ways round this are to:
>1) use an External Method
>2) write a file system product
>
>For SQL I would recommend against using External Methods because of the way
>they behave with Zope's transaction machinery (essentially they are outside
>it which is useful sometimes).
>
>So I think you would have to write a file system product to do this
>properly. Unless anyone has a better idea?
>
>A
>
>On 17/3/03 4:28 pm, "Luis Mariano Luporini" <lluporini@yahoo.com.ar> wrote:
>
>  
>
>>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?
>>    
>>
>
>  
>


------------
¡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