I would just like to print out the key, values from REQUEST.form. Why does this DTML not work? in a DTML document "process" which is the post url. (I skipped the empty form test for simplicity in this.) <!--#var standard_html_header--> <h2><!--#var title_or_id--></h2> <!--#in REQUEST.form--> <p> <!--#var sequence-key--> <!--var sequence-item--> </p> <!--#/in--> <!--#var standard_html_footer--> On the zope learning curve, Albert Boulanger aboulanger@ldeo.columbia.edu
At 09:00 PM 5/3/99 -0500, Albert Boulanger wrote:
I would just like to print out the key, values from REQUEST.form. Why does this DTML not work?
When you try this Zope gives you an error. Though sometimes cryptic, the error often can help you figure out what's wrong. In your case the error you get is Error Type: KeyError Error Value: REQUEST.form This means Zope can't find something called "REQUEST.form" In your case this is a hint that your var tag is wrong. In fact, you are trying to render a variable named "REQUEST.form", when you really want to call a method on the REQUEST's form attribute.
in a DTML document "process" which is the post url. (I skipped the empty form test for simplicity in this.)
<!--#var standard_html_header--> <h2><!--#var title_or_id--></h2>
<!--#in REQUEST.form--> <p> <!--#var sequence-key--> <!--var sequence-item--> </p> <!--#/in--> <!--#var standard_html_footer-->
You're pretty close to right, but there are a couple of problems. You want to iterate through a set of (key,value) tuples. Yet you are calling something called "REQUEST.form" to generate these tuples. What you are actually looking for is <!--#var expr="REQUEST.form.items()"--> This means evaluate an expression, which consists of calling the items method on the REQUEST's form attribute. items is a standard Python method which dictionaries support. It returns a list of (key,values) tuples. The only problem you have is a typo. <!--var sequence-item--> should be <!--#var sequence-item--> Good luck! -Amos P.S. You might want to look closely in the DTML Users Guide about the difference between the normal var tag, and using expressions with the var tag.
participants (2)
-
Albert Boulanger -
Amos Latteier