[Web-SIG] Random thoughts

Steve Holden sholden at holdenweb.com
Mon Nov 3 08:38:18 EST 2003


[Thijs]
> On Monday 03 November 2003 13:31, Steve Holden wrote:
> > > 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.
>
> I agree. The best choice in cases like these IMHO is indeed
> not to add all
> possible alternatives to an api, but to write solid and comprehensive
> documentation explaining the easiest way to get to those
> alternatives in the
> calling code.
>
> Adding an additional attribute to the request object
> containing the merged
> data is useless if you can do this yourself in one line of code.
>
> > 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.
>
> Naming was just an example following the earlier posts. I
> suggest 'post' (the
> only way to post form data is using a HTTP POST request) and either
> 'arguments', 'parameters' 'queryargs' or 'queryparams' for the query
> parameters.
>
And since it seems natural for us all to call it "data", and since input
is all data anyway, I'd suggest going with John J Lee's "postdata" vs
"querydata". Or should that be postData vs queryData?

Actually, although I was being fatuous, one thing we *can* do to help
users is adopt a well-policed consistent case convention in this new
module. I'm not even that bothered which convention we adopt, as long as
someone will police it.

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