[Web-SIG] Form field dictionaries

David Fraser davidf at sjsoft.com
Fri Oct 24 14:00:30 EDT 2003

Ian Bicking wrote:

> On Friday, October 24, 2003, at 11:28 AM, David Fraser wrote:
>> That's fine, but I think it's important that these methods are 
>> available as an addition to a standard dictionary interface.
>> I think the key point is, if somebody wants a list of values, they 
>> probably know that they want a list.
>> It's very difficult to write code by accident that would handle a 
>> list of values as well as a string.
>> So if somebody knows they want a list in certain circumstances, they 
>> could call getlist()
>> But I think the default dictionary return value should be the same as 
>> getfirst().
>> That saves endless checks for lists for those who don't need them.
> Every time I have encountered an unexpected list it has been because 
> of a bug somewhere else in my code.  I might use a getone() method 
> that threw some exception when a list was encountered, but I'd *never* 
> want to use getfirst().  getfirst() is sloppy programming.  (getlist() 
> is perfectly fine though)

There seems to be a lot of agreement on this...
So let's take it that the interface will be a dictionary, with an extra 
method defined, getlist, which will return multiple items if multiple 
items were defined, or a list containing a single item otherwise.
The next question is, how do we handle the Get/Post/Both situation?
One way would be to have methods on the request object that return the 
desired dictionary
Somebody also suggested including Cookies, as is done in PHP - I'm not 
sure this is a good idea


More information about the Web-SIG mailing list