Mailing List Archive

dtml-except
Hi,

I need the old timers to help with a zope dtml-try/dtml-except conditions. I am using Zope 2.6.1. My problem is as follows:

<dtml-if expr="fluency_temp<>''">
fluency - <dtml-var fluency_temp>**

<dtml-call "REQUEST.set('fluency_test', fluency_temp)">

<dtml-call "string_to_int(fluency_test ,REQUEST)">
<dtml-try>

<dtml-call "REQUEST.set('fluency', y)">

<dtml-except ValueError>

<dtml-call "REQUEST.set('name_error', 'error')">

<dtml-if expr="name_error=='error'">

Invalid Number entered
<a href="../prek_4_dra_scoring_system/display_student ">
Click here to go back</a>

<dtml-else>

<dtml-call "REQUEST.set('student_full_name', student_full_name)">
<dtml-call "REQUEST.set('dra', dra_temp)">
<dtml-call "REQUEST.set('date_scored', ZopeTime())">
<dtml-call "REQUEST.set('fluency', fluency)">

<dtml-call expr="update_dra_edl_score_1_4_record_eng(REQUEST)">

</dtml-if>
</dtml-try>

</dtml-if>
</dtml-in>
</dtml-if>

I will see an error if I enter a letter and not a number -

Exception Type ValueError
Exception Value invalid literal for int(): a

I have trapped for errors like this before using this method but no luck this time.

Thanks in advance,

Larry McDonnell

_______________________________________________
Zope maillist - Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope-dev )
Re: dtml-except [ In reply to ]
----- Puvodní zpráva -----
Od: <larrymcdonnell@att.net>
Komu: <zope@zope.org>
Odesláno: 4. ríjna 2010 21:57
Predmet: [Zope] dtml-except


> Hi,
>
> I need the old timers to help with a zope dtml-try/dtml-except conditions.
> I am using Zope 2.6.1. My problem is as follows:
>
> <dtml-if expr="fluency_temp<>''">
> fluency - <dtml-var fluency_temp>**
>
> <dtml-call "REQUEST.set('fluency_test', fluency_temp)">
>
> <dtml-call "string_to_int(fluency_test ,REQUEST)">
> <dtml-try>
>
> <dtml-call "REQUEST.set('fluency', y)">
>
> <dtml-except ValueError>
>
> <dtml-call "REQUEST.set('name_error', 'error')">
>
> <dtml-if expr="name_error=='error'">
>
> Invalid Number entered
> <a href="../prek_4_dra_scoring_system/display_student ">
> Click here to go back</a>
>
> <dtml-else>
>
> <dtml-call "REQUEST.set('student_full_name', student_full_name)">
> <dtml-call "REQUEST.set('dra', dra_temp)">
> <dtml-call "REQUEST.set('date_scored', ZopeTime())">
> <dtml-call "REQUEST.set('fluency', fluency)">
>
> <dtml-call expr="update_dra_edl_score_1_4_record_eng(REQUEST)">
>
> </dtml-if>
> </dtml-try>
>
> </dtml-if>
> </dtml-in>
> </dtml-if>
>
> I will see an error if I enter a letter and not a number -
>
> Exception Type ValueError
> Exception Value invalid literal for int(): a
>


fluency - <dtml-var fluency_temp missing="N/A" null="N/A">**

<dtml-try>

<dtml-call "REQUEST.set('fluency_test', _.int(fluency_temp))">

<dtml-call "REQUEST.set('fluency', y)">

<dtml-call "REQUEST.set('student_full_name', student_full_name)">
<dtml-call "REQUEST.set('dra', dra_temp)">
<dtml-call "REQUEST.set('date_scored', ZopeTime())">
<dtml-call "REQUEST.set('fluency', fluency)">


??? what you want to do with this ???
<dtml-call expr="update_dra_edl_score_1_4_record_eng(REQUEST)">
??? what you want to do with this ???

<dtml-except ValueError>

<dtml-call "REQUEST.set('name_error', 'error')">

Invalid Number entered
<a href="../prek_4_dra_scoring_system/display_student ">
Click here to go back</a>

</dtml-try>


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