[Zope] What is the Python script that is similar to a dtml-in call

Andreas Jung andreas at andreas-jung.com
Mon May 31 07:52:12 EDT 2004



--On Montag, 31. Mai 2004 7:37 Uhr -0400 Larry McDonnell 
<larry at technologyinedu.com> wrote:

> Hi,
>
> I need some advice. I still use dtml calls in my systems. My problem is
> if the user is searching for a record but the record is not found. The
> call is as follows:
>
> <dtml-call "REQUEST.set('serial_number', serial_number)">
>
> <dtml-in lookup_header_record>
>   <dtml-call "REQUEST.set('equip_type', equip_type)">
>   <dtml-call "REQUEST.set('pr', pr)">
> </dtml-in>
>

Modifying the REQUEST using REQUEST.set() is in general bad-style
and a DON'T DO IT.

> If the record is not found I get this error:
>
> Error Type: KeyError
> Error Value: equip_type
>
> True statement since there is not record and further in the form I am
> trying to output this variable.
> Are there any examples that either traps for an error or python script
> that can also lookup the record and true a found/not found status.
>

Look at the Python documentation try...except or whatever....you questions
sounds like you really want to learn Python :-)

-aj




More information about the Zope mailing list