Graham Dumpleton
grahamd at dscpl.com.au
Fri Oct 27 18:45:32 EDT 2006
On 27/10/2006, at 4:42 PM, Graham Dumpleton wrote: > Mike Looijmans wrote .. >> Another, >> idea is, could we support the following: >> >> form = FieldStorage(...) >> myfrm = {} >> myfrm.update(form) > > That works now. possibly because of the items() method. Although this works now, it truly only works as one would expect if there is at most one value against each form field. If there is more than one value for a field then all but the last value found for that field will be lost. This underscores the fact that it only really behaves like a dictionary when there is at most one value for every field. Although this is the case, after some thinking, it is probably reasonable to add __setitem__ (equiv to add_field, ie. additative), and __delitem__. One could even go as far as adding clear(), pop() and popitem(), but probably do not want to encourage the idea that it is truly a dictionary. Having made such a change, it would just need to be made quite clear about when and when it doesn't behave like a dictionary. Graham
|