[Web-SIG] Random thoughts

Steve Holden sholden at holdenweb.com
Mon Nov 3 07:31:04 EST 2003


> -----Original Message-----
> From: Thijs van der Vossen [mailto:t.vandervossen at fngtps.com]
> Sent: Monday, November 03, 2003 3:20 AM
> To: sholden at holdenweb.com
> Cc: web-sig at python.org
> Subject: Re: [Web-SIG] Random thoughts
>
>
> On Monday 03 November 2003 01:05, Steve Holden wrote:
> > > >   * I oppose Simon Willison's practice of using the
> same variable
> > > >     in the "GET" and "POST" part of a request, but I
> will defend to the
> > > >     death his right to do so.  (But not in Quixote,
> where a narrower
> > > >     definition of what is Right, Good, and Truthfull prevails.)
> > >
> > > I don't get it.  Any particular request only has one
> method, not two:
> > > "GET" and "POST".  Are you talking about for some reason
> > > special-casing these two methods in the Request class?  I think it
> > > makes more sense to do things generically:
> > >
> > > ...
> >
> > The question is how to integrate data from a POST request
> (i.e. from the
> > standard input of the PORT transaction) and any parameters
> that may be
> > included in the for action's URI (e.g. if the form has an action
> > attribute such as "form.py?extra1=val1&extra2=val2")
>
> Before asking _how_ we might first want to decide if we
> _should_. What's wrong
> with having both a 'parameters' (query params) and a
> 'form-data' (posted form
> data) dictionary as attributes of the request object?
>
> In your code you could merge these two with a single line of code:
>
>   merged = request.parameters.update(request.form-data)
>
> Where the posted form data will overwrite the query
> parameters with the same
> name. You can also do this the other way round ofcourse.
>
Of course, you *could*. But you will find that whatever you choose to
do, there will be users whose use cases don't fit your choices. And, of
course, if you choose to offer all possible alternatives then some
people will complain that it's too complicated.

On balance, your suggestion seems the most practical except for the
naming (form-data is not a valid name). Maybe formargs and queryargs, or
formdata and querydata, or some such, leaving the user to merge the two
sets as (and only when) required.

regards
--
Steve Holden          +1 703 278 8281        http://www.holdenweb.com/
Improve the Internet           http://vancouver-webpages.com/CacheNow/
Python Web Programming                http://pydish.holdenweb.com/pwp/
Interview with GvR August 14, 2003       http://www.onlamp.com/python/







More information about the Web-SIG mailing list