[Zope] Sort by key in dtml-in loop over dictionary

Pierre Godefroy pierre.godefroy@noos.fr
Sat, 15 Jun 2002 15:46:33 +0200


Hi everybody!

I have a dtml-in loop which iterates over a dictionary :

<dtml-in collectionOfStr1s sort=title>
<dtml-var "collectionOfStr1s[_['sequence-index']]['title']">
<dtml-var "collectionOfStr1s[_['sequence-index']][''ancestor']">
</dtml-in>

The "collectionOfStr1s" dictionary was previously fed with successive 
dtml-calls :

<dtml-call "collectionOfStr1s.append({''ancestor':ancestor, 'title':title})">
etc.

Everything works fine except that the result of the dtml-in loop is always 
unsorted (at least certainly not by title : it just spits out the 
dictionary entries in the order in which they were entered.

I have a feeling I am missing something stupid but essential...

Could you help me?

Pierre Godefroy