dtml methods and dictionaries
I need to write a dtml method which calls an external method, which returns a dictionary, and have the dtml method lookup and use keys and values from the dictionary. Is this even possible? If so how? I am completely stuck! I would really appreciate any help with this. Thanks. Phil C
Philip Corp wrote:
I need to write a dtml method which calls an external method, which returns a dictionary, and have the dtml method lookup and use keys and values from the dictionary. Is this even possible? If so how? I am completely stuck! I would really appreciate any help with this. Thanks.
Just off the top of my head (untested!) the following sort of thing should work: def AnExtMeth(): return {1: 'one', 2: 'two', 3: 'three'} <dtml-let dict="AnExtMeth()"> <dtml-in expr="dict.items()"> &dtml-sequence-key; &dtml-sequence-item; </dtml-in> 1: <dtml-var expr="dict[1]"> </dtml-let> or <dtml-call expr="REQUEST.set('dict', AnExtMeth())"> to make the dictionary generally available. Cheers, Evan @ 4-am
participants (2)
-
Evan Simpson -
Philip Corp