Miguel Beltran R. wrote at 2008-12-8 21:01 -0600:
>I trying the next, but not work say " invalid syntax (Script (Python), line
>2008/12/6 robert rottermann <[EMAIL PROTECTED]>
>> hi,
>> I think you should  write in a python script:
>> try:
>>  result = context.insert_data.zsql
>>  msg = 'data inserted'
>> except StandardError as e:             <-- error here

The "as" should be "," instead.

After the removal of this error, you will meet the next two,
I have already pointed out in a message sent yesterday.

> ...
>If change to
>   result=context.proyecto_alta_zsql()
>   msg="Se incertaron los datos correctamente"
>except StandardError, (e1,e2):
>   msg = "Error valor %s y %s" % (e1,e2)
>return msg
>Tipo: Unauthorized
>Valor: You are not allowed to access 'a particular str' in this context

Already much better :-)

In exceptional cases, the "(e1, e2)" might work. However,
usually, exceptions are no sequences and an exception cannot be matched
with "(e1, e2)".

Try "except StandardError, e:" (and, of course, change the following
line accordingly).

Whenever you get exceptions, you should look at the error
description in your "error_log" object (in the Zope "Root Folder" of the ZMI).
There, you can see (in the so called traceback) where the exception
has been raised. This is invaluable information.

Usually, "error_log" ignores "Unauthorized". Therefore, you must
temporarily reconfigure the "error_log" in order to get the information.
Should you have problems to understand it, come back with the information.

Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to