Stefane Fermigier wrote:

> Hi,
> 
> please try this as a DTML Method:
> 
> <dtml-let l="[[1, 2], [3, 4]]">
> <dtml-in l>
>   <dtml-var "_['sequence-item']"><br>
> </dtml-in>
> </dtml-let>
>        
> <dtml-let l="[(1, 2), (3, 4)]">
> <dtml-in l>
>   <dtml-var "_['sequence-item']"><br>
> </dtml-in>
> </dtml-let>
> 
> Why should the two results differ ?


This is a designed-in feature of dtml-in.

When you call an items() method on a dictionary-like object, you get 
back a list of two-tuples: [(key1,value1), (key2,value2, ...]

It is often nice to iterate through such a list in dtml, so, dtml-in 
detects that the next item in the iteration is a two-tuple, and puts the 
elements of the tuple in sequence-key and sequence-item.

  If you look throughthe zope-dev list archives, you'll find a number of 
arguments on each side as to whether this is a bug or a feature.

--
Steve Alexander
Software Engineer
Cat-Box limited



_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to