[Python-Dev] Re: dict.setdefault() (Patch#101102) (original) (raw)

Ka-Ping Yee ping@lfw.org
Tue, 8 Aug 2000 13:29:52 -0700 (PDT)


On Tue, 8 Aug 2000, Peter Funk wrote:

Unfortunately only a small subset of these methods actually works on a dbm mapping: >>> import dbm >>> d = dbm.open("piff", "c") >>> d.get('foo', []) Traceback (innermost last): File "", line 1, in ? AttributeError: get

I just got burned (again!) because neither the cgi.FieldStorage() nor the cgi.FormContentDict() support .get().

I've submitted a patch that adds FieldStorage.get() and makes FormContentDict a subclass of UserDict (the latter nicely eliminates almost all of the code in FormContentDict).

(I know it says we're supposed to use FieldStorage, but i rarely if ever need to use file-upload forms, so SvFormContentDict() is still by far the most useful to me of the 17 different form implementations in the cgi module, i don't care what anyone says...)

By the way, when/why did all of the documentation at the top of cgi.py get blown away?

-- ?!ng

"All models are wrong; some models are useful." -- George Box