[Zope] REQUEST Key Error

alan runyan alan runyan" <runyaga@thisbox.com
Sat, 13 May 2000 14:21:48 -0500


>   I am trying to get data from a form, and I am using the REQUEST
variable.

easiest thing since slice bread :)

> When i simple do <dtml-var REQUEST> it prints out all of the variables i
> have access to.

yup that is basically a chunk of HTTP namespace.

> When i try getting to a single one such as <dtml-var
> REQUEST['foo']> i get a KeyError (and foo was one of the variables listed
> when i simply printed REQUEST).

why not just <dtml-var foo> ? all FORM variables are in your namespace.  but
to answer your question (please correct me if I'm wrong) - but REQUEST is a
REQUEST object, not a dictionary object. (?)

create DTMLMethod called aMethod:

<dtml-var standard_html_header>
<dtml-if foo>
  out of the namespace: <dtml-var foo><br>
  print foo property of REQUEST object: <dtml-var "REQUEST.foo">
<dtml-else>
  <form name="aform" action="aMethod">
   <input type=text name="foo">
  </form>
</dtml-if>
<dtml-var standard_html_footer>

hth,
~runyaga