[ZPT] tal:repeat over the sorted keys of a dictionary

Shane Hathaway shane at zope.com
Fri Jul 25 12:22:36 EDT 2003


Jean Jordaan wrote:
>        <ul tal:define="keys licenses/keys; dummy keys/sort"
>            tal:repeat="key keys">
>            <li tal:content="python:licenses[key]" />
>        </ul>
> 
> That "dummy" isn't pretty. More natural idioms would be welcomed.

Well, FWIW, this is yet another case that would benefit from prefixes. 
Something like this:

        <ul tal:repeat="key licenses/keys/format:sort">
            <li tal:content="licenses/key" />
        </ul>

Shane




More information about the ZPT mailing list