RC Compaan writes:
 > I have a list:
 > mylist=[('R',31),('I',80),('A',80),('S',23),('E',35),('C',21)]
 > I want to rebuild the list sorted from high to low on the sequence-item.
 > When i call  <dtml-in mylist sort=sequence-item reverse> the list gets
 > sorted on the sequence-key not the sequence-item.  As I understand the
 > alphabetical characters are the sequence-keys and the float values are the
 > sequence-items.
 > Where do misunderstand?
What you see is caused by the following code in

        if has_key('sort'):
            if sort=='sequence-item': self.sort=''

This means, "dtml-in sort=sequence-item" does not sort
by "sequence-item" but by the complete tuple (key,item).

I think, the special treatment of lists of pairs is
altogether a slight misfeature. It would probably
have been better to use a special "dict" attribute
in analogy to the "mapping" attribute to call
for the special pair interpretation.
'sequence-item' should then still be the complete item
and 'sequence-value' the second pair component.
Probably, it is too late by now to change this.


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

Reply via email to