I have confirmed that this is strange behavior can be reproduced on 2.1.6 --
why I don't know.  A work around may be to convert your tuples to lists (easy to
do in python)  sample working code:

<dtml-var standard_html_header>


<h4>Iterate over 3.tuples</h4>
<dtml-let list="[('a','b','c'),('d','e','f')]">
<dtml-in list>
        <dtml-var sequence-item><br>
        <dtml-in sequence-item>
                <dtml-var sequence-item></br>
        </dtml-in>                 
</dtml-in>
</dtml-let>

<h4>Iterate Over 2-tuples</h4>

<!---- My change here ------>
<dtml-let list="[['a','b'],['c','d']]">
<dtml-var list><br>
<dtml-in list>
        <dtml-var sequence-item><br>
        <dtml-try>

        <dtml-in sequence-item>
                <dtml-var sequence-item></br>
        </dtml-in>

        <dtml-except>
                <h4>Why can't I do this!</h4>
        </dtml-try>        
</dtml-in>
</dtml-let>

<h4>Iterate Over 1-tuples</h4>
<dtml-let list="[('a',),('b',)]">
<dtml-in list>
        <dtml-var sequence-item><br>
        <dtml-in sequence-item>
                <dtml-var sequence-item></br>   
        </dtml-in>                 
</dtml-in>
</dtml-let>


<dtml-var standard_html_footer>


On Sat, 01 Jul 2000, Cary O'Brien wrote:
> Ok.  I get a list of rows from a database query.  I want
> to iterate over the rows.  If there are 3 or more
> columns in the table, everythin is fine.  If there are 2 
> columns, it doesn't work.
> 
> It seems as if dtml-in handles lists of pairs specially. 
> Not a good thing.  Can I supress this behavior?
> 
> Here is an example of this:
> 
> -------------------
> 
> <h4>Iterate over 3.tuples</h4>
> <dtml-let list="[('a','b','c'),('d','e','f')]">
>    <dtml-in list>
>       <dtml-var sequence-item><br>
>       <dtml-in sequence-item>
>          > <dtml-var sequence-item></br>
>       </dtml-in>              
>    </dtml-in>
> </dtml-let>
> <h4>Iterate Over 2-tuples</h4>
> <dtml-let list="[('a','b'),('c','d')]">
>    <dtml-in list>
>       <dtml-var sequence-item><br>
>       <dtml-try>
>       <dtml-in sequence-item>
>          > <dtml-var sequence-item></br>
>       </dtml-in>
>       <dtml-except>
>         <h4>Why can't I do this!</h4>
>       </dtml-try>     
>    </dtml-in>
> </dtml-let>
> <h4>Iterate Over 1-tuples</h4>
> <dtml-let list="[('a',),('b',)]">
>    <dtml-in list>
>       <dtml-var sequence-item><br>
>       <dtml-in sequence-item>
>          > <dtml-var sequence-item></br>
>       </dtml-in>              
>    </dtml-in>
> </dtml-let>
> 
> -----------------------
> 
> -- cary
> 
> _______________________________________________
> Zope maillist  -  [EMAIL PROTECTED]
> 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  -  [EMAIL PROTECTED]
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 )

Reply via email to