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

Small Business Services toolkit at magma.ca
Mon May 31 12:54:08 EDT 2004

From: Larry McDonnell

Within the dtml-in statement, I use serial_number to find the record in the
db. I checking for a valid serial number but what is return from the dtml-in
statement if the serial number lookup is not found.

If you are doing individual db look-ups within a dtml-in loop then you need
to check the return value from each db look-up call:


<dtml-in lookup_header_record>
  <dtml-let rstatus="dbGet(_['sequence-item'])">
    <dtml-if "rstatus != 'success'">
        No success for item: <dtml-var sequence-item><br>

Alternatively, you could store the 'failed' returns and then handle them all
at once:

<dtml-call "REQUEST.set('errflag', {})">
<dtml-in lookup_header_record>
  <dtml-let rstatus="dbGet(_['sequence-item'])">   ***dbGet is your db
lookup function
    <dtml-if "rstatus != 'success'">   *** dbGet must return some status
       <dtml-call "errflag.update({_['sequence-item'] : 'failed'})">

<dtml-if "errflag != {}">
  Errors during db lookup: <dtml-var errflag>


<dtml-if "errflag != {}">
  <dmtl-in "errflag.keys()">
      Errors during db lookup: <dtml-var "errflag[_['sequence-item']]">



Caveat:  above code is NOT tested

More information about the Zope mailing list