[Zope] interating though REQUEST.form in python???

Patrick Lewis pl@teleport.com
Tue, 8 Aug 2000 12:49:46 -0700


On Tue, Aug 08, 2000 at 04:16:15PM -0300, Kevin Howe wrote:
> I'm trying to do a FOR statement to loop though items in a REQUEST, but keep
> getting errors:
> 
> def myMethod(self,REQUEST):
>   for name,value in REQUEST.form:
>     # do this
> 
> I've tried variations:
> 
> for name,value in REQUEST.items:
> for item in REQUEST.form.items:
> for key in REQUEST.keys:
> 
> but none seem to work.
> 
> When I used "return REQUEST.form", a Dictionary was displayed like so:
> 
>   {'item': 'val1', 'item2':'val2', etc.}
> 
> so I tried fetching it as a plain dictionary:
> 
>   form = REQUEST.form
>   return form.keys

I think you want 

   for key in REQUEST.form.keys():

> 
> but no luck.
> 
> Is it not possible to access the REQUEST methods via python?
> 
> Kevin
> 
> 

-- 
Patrick Lewis <pl@teleport.com>