[Web-SIG] Random thoughts
ianb at colorstudy.com
Mon Nov 3 13:39:59 EST 2003
On Nov 3, 2003, at 12:23 PM, John J Lee wrote:
>> They could be proper dictionary-like objects. Though if they aren't
>> real dictionaries, I suppose we would have:
>> request.fields, request.fields.post, request.fields.query, each of
>> which implements a dictionary interface.
> Why does the dictionary-ness of these objects force moving them from
> attributes of request into attributes of a fields object? I don't like
> __getitem__, but I like breaking the "law of demeter" less. If people
> prefer to avoid __getitem__, they could just be methods: .formdata(),
> .querydata(), .postdata() (or use the new descriptor stuff? I know
> nothing about that...).
Sorry, I mixed that up a bit, I should have said: if form values are
dictionaries (*not* just dictionary-like) then the request object has
to have three objects for the three options (query, post, and mixed).
If we use a dict subclass (or just implement __getitem__ and frields)
then "fields" (or "formdata" or whatever) could have the .post and
.query attributes (which obviously aren't attributes of a normal
If we want to add .getlist() and other options as well (which I think
we do), we've already given up strict dictionariness. Personally I
like fields.post and fields.query more than having three separate
attributes of request.
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org
More information about the Web-SIG