Re: [Zope] interating though REQUEST.form in python???
Kevin Howe writes: > for name,value in REQUEST.form.items: Try: for name,value in REQUEST.form.items(): "items" is a method that must be called to return a sequence of tuples. Dieter ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] interating though REQUEST.form in python???
> for name,value in REQUEST.form.keys(): > > Note the function call (parentheses). Oops! I meant: for key in REQUEST.form.keys(): --jfarr "Perl is worse than Python because people wanted it worse." Larry Wall, 14 Oct 1998 ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] interating though REQUEST.form in python???
for name,value in REQUEST.form.keys(): Note the function call (parentheses). --jfarr "Perl is worse than Python because people wanted it worse." Larry Wall, 14 Oct 1998 ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] interating though REQUEST.form in python???
Yes, when I use this I get the following error: Error Type: TypeError Error Value: loop over non-sequence Kevin - Original Message - From: "peter be" <[EMAIL PROTECTED]> To: "Kevin Howe" <[EMAIL PROTECTED]> Sent: Tuesday, August 08, 2000 5:05 PM Subject: SV: [Zope] interating though REQUEST.form in python??? > > Have you tried?: > > for name,value in REQUEST.form.keys: > # kewl stuff > > > - Original Message - > From: Kevin Howe <[EMAIL PROTECTED]> > To: ZOPE Mailing List <[EMAIL PROTECTED]> > Sent: Tuesday, August 08, 2000 8:16 PM > Subject: [Zope] interating though REQUEST.form in python??? > > > > 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 > > > > but no luck. > > > > Is it not possible to access the REQUEST methods via python? > > > > Kevin > > > > > > > > > > ___ > > Zope maillist - [EMAIL PROTECTED] > > http://lists.zope.org/mailman/listinfo/zope > > ** No cross posts or HTML encoding! ** > > (Related lists - > > http://lists.zope.org/mailman/listinfo/zope-announce > > http://lists.zope.org/mailman/listinfo/zope-dev ) > > > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] interating though REQUEST.form in python???
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 <[EMAIL PROTECTED]> ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )