Alric Aneron wrote:
Hello,Alric, Your earlier post indicated that your DTML obtains the sequence of dictionaries from a python script - and *then* tries to filter it and process it. Why not do your filtering, e.g. appending only thoses values that have a key == 'key1' in your python script first? Thats why "god" invented python scripts :-) . And as Jonathan indicated, you should also simplify the list returned. I would just return a list of filtered values, e.g. # ----------------------------------------------- # python script (based on your earlier message) # ----------------------------------------------- # DTML call to this script can pass these as parameters or obtain them from the request ... mydict = {'key1': 'value1', 'key2': 'value2'} mydict2 = {'key1': 'value3', 'key2': 'value4'} desired_key = 'key1' #results bucket finalList = [] for dict in (mydict,mydict2): # we avoid returning list of dictionaries which can be awkward in DTML for k in dict.keys(): if k == desired_key: # <------- filter it here so DTML doesn't have to finalList.append( dict[ k ] ) return finalList Now your DTML is simple. David |
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )