[Zope-dev] [] vs () in dtml-in: is this a bug ?

2001-04-22 Thread Stefane Fermigier

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 ?

S.

-- 
Stéfane Fermigier, Tel: 06 63 04 12 77 (mobile).
http://nuxeo.com/  http://portalux.com/  http://aful.org/
Amazon: we patent the dot in .com

___
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 )



Re: [Zope-dev] [] vs () in dtml-in: is this a bug ?

2001-04-22 Thread Steve Alexander

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 )



Re: [Zope-dev] [] vs () in dtml-in: is this a bug ?

2001-04-22 Thread Stefane Fermigier

On Sun, Apr 22, 2001 at 01:16:57PM +0100, Steve Alexander wrote:
 
   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.

Thanks. I definitely call that a bug.

S.

-- 
Stéfane Fermigier, Tel: +33 (0)6 63 04 12 77 (mobile).
http://nuxeo.com/  http://portalux.com/  http://aful.org/
Amazon: we patent the dot in .com

___
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 )