Marie Robichon wrote:
Hi all,
I have an External Method that parses a file and put the title, body, list of links, list of images into a dictionary.
How do I now go about getting the info out of this dictionary?
If I do a <dtml-var "filescript(REQUEST)">
it gives me the dictionary itself :
{'title': 'Industrial Co-ordination Office', 'links': 'applications', 'index', 'partnershipweblinks', 'breakthroughs', 'pdf/applications.pdf', 'presentation', 'presentation', 'services', 'collaboration', 'workshop', 'documentation', 'techniques', 'techniques', 'pdf/techniques.pdf', , 'body':\r\n\r\n Beamlines\r\n\r\n (etc, etc), 'images': ['img/red.gif', 'img/indcodiv44.gif']}
How do I get the value of each dictionary key back and how do I get rid of those horrible '\r\n\r\n". If I do a dtml-in it tells me that I cannot do a dtml-in with strings.
hi, maybe something like this will do. simply replace the <dtml-let> with your dictionary: <dtml-let dict="{'title':'Dr.','name':'Jekill\r\n\r\n'}"> <dtml-in "dict.keys()" prefix=dc> <dtml-var dc_item>: <dtml-var "dict[dc_item].replace('\r\n','')"> </dtml-in> </dtml-let> -maik -- Maik Jablonski __o www.zfl.uni-bielefeld.de _ \<_ Deutsche Zope User Group Bielefeld, Germany (_)/(_) www.dzug.org