[cse491] HW 5 POSTs with Queries

C. Titus Brown ctb at msu.edu
Mon Oct 12 14:03:09 PDT 2009


On Mon, Oct 12, 2009 at 04:58:37PM -0400, Tim Miller wrote:
> I'm sorry, I don't quite understand.  You recommended we use
> cgi.parse_qs, which parses URL query strings, but here you are saying
> we will not need to parse those?  Are POST data query strings
> formatted the same way?  And do we still ignore URL query strings?

Hey Tim, thanks for asking -- 

There are three possibilities:

1. GET, with query data on the URL after '?'
2. POST, with query data in the POST content
3. POST, with query data in the POST content *and* in the URL

You can generate #1 by putting "method='GET'" in your form.html,
and #2 by putting "method='POST'" in your form.html.

For #3, there is no need to handle it.

And yes, cgi.parse_qs (and urlparse.parse_qs, in Python 2.6) can be used to
handle both POST content and URL query strings.

Clearer?

cheers,
--titus



More information about the cse491-fall-2009 mailing list