[Zope] REQUEST.form variables order

Gaute Amundsen gaute at div.org
Fri Apr 21 16:38:20 EDT 2006


On Friday 21 April 2006 21:04, Dieter Maurer wrote:
> Gaute Amundsen wrote at 2006-4-21 11:01 +0200:
> >On Thursday 20 April 2006 20:11, Dieter Maurer wrote:
> >> Gaute Amundsen wrote at 2006-4-19 19:03 +0200:
> >> >I want to retrieve the form fields in the order that they where
> >> > submitted in the http POST. I know this has been brought up before,
> >> > and that the answer is "You cant."
> >>
> >> You might be able to do it.
> >>
> >>    Try "REQUEST['BODY']". For a "POST" request, it should
> >>    contain the entity content.
> >>
> >>    Of course, you would have to decode it yourself ;-)
> >
> >What? It can't be that simple!
> >I thougt I had been poking all around the corners of REQUEST, looking for
> > just somthing like that.
> >
> >Hm.. no.
> >
> >Error Type: KeyError
> >Error Value: 'BODY'
> >
> >Are you sure about this?
>
> I was wrong.
>
>   "BODY" is only defined in the "read_single" case
>   (see "cgi.FieldStorage" for details) -- this means:
>   not for "application/x-www-form-urlencoded" nor
>   for "multipart/" content types (and therefore not
>   for general "POST" requests as I claimed).
>
>  "FieldStorage" however still preserves the field order
>  (in "FieldStorage.list"). The order is lost
>  in "ZPublisher.HTTPRequest.HTTPRequest.processInputs".

Hm.. you have had a second look I see :)

Now REQUEST.stdin and cgi.parse_qsl solved my problem neatly,
and this kind of "under the hood" work stil is a bit of a chalenge for me, 
so I'm afraid l will not work on a more "proper" solution this time.

But thanks for looking into it.

Gaute



More information about the Zope mailing list