Hi guys, I want to create a sendmail-Method which works with several forms. For that I want to list the variables and their values independent from each form. <dtml-var "REQUEST.form"> works, but the output is: {'comments': 'my comment', 'name': 'my name'}. What I would like to see is: comments: my comment name: my name' but I don't want to create for each form a sendmail-Method which includes: comment: <dtml-var comments> Name: <dtml-var name> My idea was something like <dtml-in "REQUEST.form"> <dtml-var name>: <dtml-var value> </dtml-in> but REQUEST.form isn't a sequence!? I guess this is an easy question. Thank you in advance, Tapio
Tapio Hüffner wrote: <...>
My idea was something like
<dtml-in "REQUEST.form"> <dtml-var name>: <dtml-var value> </dtml-in>
but REQUEST.form isn't a sequence!?
No, it's something far better than a sequence, its a dictionary ;-)) Try this: <dtml-in "REQUEST.form.keys()"> Var:&dtml-sequence-item;, Value:<dtml-var "REQUEST.form[_['sequence-item']]"><br> </dtml-in> A dictionary is an associative array, in which values are referenced by keys, in this case the name of the form variable. You get lists by predefined methods, every python dictionary has like keys() for a list of keys und values() for a list of values.
I guess this is an easy question. Thank you in advance,
Yes, for pythonists.
Tapio
Michael -- Michael Gutmann M.A. gutmann@uni-duesseldorf.de Multimediazentrum Heinrich-Heine-Universitaet Duesseldorf
participants (2)
-
Michael Gutmann -
Tapio Hüffner