durusmail: quixote-users: GET, POST, QUERY_STRING and FieldStorage
GET, POST, QUERY_STRING and FieldStorage
2003-03-22
2003-03-22
2003-03-25
Re: GET, POST, QUERY_STRING and FieldStorage
2003-03-25
2003-03-25
GET, POST, QUERY_STRING and FieldStorage
Jason Sibre
2003-03-22
Hi folks,

I haven't researched this at all, so I don't know exactly how Quixote
behaves regarding this, but I have an opinion on it:

If the method is GET, obviously, the query string is where the data is.
Should it be considered 'form' data?  Personally, I don't think so, but it
doesn't really matter.  If the method is POST, then the form data is
certainly the most important data, but the data in the query string should
processed and made available.  They should NOT be combined, IMO.  For
example, if there is a name/value pair of "name=jason" in the query string,
and "name=john" in the form data, then I, as the developer, would like
access to both, and be able to tell where they came from (i.e., don't blend
them together as "name=jason,john" or "name=jason&name=john", etc, so that I
can't tell which came from where.)

The idea I like (and I admit, I haven't thought the through very far, so
maybe it isn't practical), is a hodge-podge of other web environments I've
worked with (PHP, ColdFusion, and MS's ASP):

I'd like to see something like:

REQUEST.COOKIES[]       - contains cookie data
REQUEST.QUERYSTRING[] - always contains querystring data, whether GET or
POST
REQUEST.FORM[] - only contains POSTed data if it exists.

and a convenience accessor of:

REQUEST[]

which would look first in the form, and if it didn't find the key there then
look in the query string, and if it doesn't find it there look in the
cookies.  This way, you (as a developer) don't have to worry about where the
data is all the time, but you can check into it if it is important.
Further, the most volitile data is given highest priority, and the least
volitile the lowest.

The names of the above accessors are not important, just the idea.  I'm
pretty sure we couldn't use REQUEST[] in that way because of a clash, and
while I don't see a problem with the other names, I honestly don't know if
that's how it's already being used, or if such a usage would break existing
apps.

And that's all I have to say about that. ;)

Jason




-----Original Message-----
From: quixote-users-bounces@mems-exchange.org
[mailto:quixote-users-bounces@mems-exchange.org]On Behalf Of Lucio Torre
Sent: Friday, March 21, 2003 11:02 PM
To: quixote-users@mems-exchange.org
Subject: [Quixote-users] GET, POST, QUERY_STRING and FieldStorage


Hello all,

I have an application that uses quixote and needs to work with forms. My
problem arises when i want to read the values in QUERY_STRING when the user
performed a POST. If the REQUEST_METHOD is GET, then the keys and values are
in request.form, but if it is POST, they are not. I can only find the values
from the form.

I traced the issue back to FieldStorage. This class will choose only one
source for data depending on the request method. Because i needed the query
string, i changed my application so that with every POST request, the query
string parameters are aded to the form dictionary.

So, here are my questions:
- Is request.form the correct way i should read the query string?
- Is this behaviour a feature or a bug?
- Should quixote read from post data *and* query string? If yes, id be happy
to produce a patch.
- Should FieldStorage read from post data *and* query string?

Thanks in advance,

Lucio.


_______________________________________________
Quixote-users mailing list
Quixote-users@mems-exchange.org
http://mail.mems-exchange.org/mailman/listinfo/quixote-users


reply