I am calling a python script which wraps around a ZSQL method and simply returns the result set. The set comes back as a list of dictionaries. I'm getting stuck because I can't figure out how to tell TAL to to 1) grab each item and 2) grab the value associated with each dictionary key.
I'm scratching my head trying to figure out how to to iterate over a list using TAL. Here's the scenario:
Iterating over a list (coming from a script) is as usual: <span tal:repeat="element container/list_making_script"> <span tal:content="element/attribute">Value of some attribute of an element of a list</span> </span> Iterating over a dictionary's values is thus: <span tal:repeat="value context/dictionary/values"> <span tal:content="value">Value from a dictionary</span> </span> (Note that this is the usual Python method for getting the values of a dictionary. In Python, one would say dict.values() instead. You can also use dict.keys(), or with a little more work, dict.items() in the same manner.) So put 'em together: <span tal:repeat="dictionary container/list_making_script"> <span tal:repeat="value dictionary/values"> <span tal:content="value">Some value from a dictionary in a list</span> </span> </span> --jcc