[Zope] <dtml-elif> problem

D. Rick Anderson ruger@comnett.net
Fri, 02 Aug 2002 10:24:25 -0700


oops... sorry .. let's try that again:

<dtml-if expr="filename[3:6]=='do_')">
     <dtml-call "REQUEST.set('dir', 'do_')">
<dtml-elif expr="filename[3:6]=='aa_'">
     <dtml-call "REQUEST.set('dir', 'aa_')">
<dtml-else>
     <dtml-call "REQUEST.set('dir', 'vth')">
</dtml-if>

There. That looks better. Was in too big of a hurry. The point here is 
that you need to push those variables to REQUEST if you need access to 
them outside the <dtml-if> statements.

Rick

D. Rick Anderson wrote:

> It's looking for the close of the <dtml-let> statement. The best thing 
> to do would be:
>
> <dtml-if expr="filename[3:6]=='do_'"><dtml-call "REQUEST.set('dir', 
> 'do_')"> <dtml-elif expr="filename[3:6]=='aa_'"><dtml-call 
> "REQUEST.set('dir', 'aa_')">
> <dtml-else><dtml-call "REQUEST.set('dir', 'vth')">
>
> Rick
>
>
>
>
> Tom Germaine wrote:
>
>> Hi All:
>>
>> I am trying to download files (with standardized filenames) to 
>> specific subdirectories with a form that calls a dtml document for 
>> processing, but the code breaks at the dtml-elif phrase:
>> --------
>> <dtml-var standard_html_header>
>>
>> <h2><dtml-var title></h2>
>>
>> <dtml-let fname="_.string.split(myfile.filename,'\\')[-1]">
>> <dtml-let filename="_.string.split(fname,'.html')[0]">
>>
>> <dtml-if expr="filename[3:6]=='do_'"><dtml-let dir="do_">
>> <dtml-elif expr="filename[3:6]=='aa_'"><dtml-let dir="aa_">
>> <dtml-else><dtml-let dir="vth">
>>
>> <dtml-with avc>
>> <dtml-call
>>  expr="dir.manage_addDTMLDocument(filename,mytitle)">
>> </dtml-with>
>>
>> </dtml-let>
>> </dtml-if>
>>
>> </dtml-let>
>> </dtml-let>
>>
>> <dtml-var showFiles>
>> <dtml-var standard_html_footer>
>> -------
>> with error message: Unexpected tag, for tag <dtml-elif 
>> expr="filename[3:6]=='aa_'">
>>
>> However, the code function ok if dtml-elif and dtml-else lines are 
>> omitted.
>> I cannot understand why and would appreciate any solutions.
>>
>> Tom Germaine
>>
>> ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
>> Tom Germaine
>> System Administrator
>> UPEI Access Services
>> tgermaine@upei.ca
>> 566-0465
>> ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
>>
>> _______________________________________________
>> Zope maillist  -  Zope@zope.org
>> http://lists.zope.org/mailman/listinfo/zope
>> **   No cross posts or HTML encoding!  **
>> (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce
>> http://lists.zope.org/mailman/listinfo/zope-dev )
>>
>>  
>>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>