Message60415
[From a post to python-help]
If an instance of the cgi module's FieldStorage class doesn't
recognize the HTTP request it's trying to parse as a form, no
error is raised but attempting to access any of the form data
later raises the unhelpful exception TypeError, "not
indexable".
It seems that even Andrew Kuchling was once confused by
this behavior:
http://groups.yahoo.com/group/web-sig/message/28
It happens because in the FieldStorage class's __init__(), the
request's content-type is tested against "multipart/" and
"application/x-www-form-urlencoded". If it doesn't match
either of those, read_single() is called. In that case, self.list
isn't changed from its default of None. That causes any call
to __getitem__() to raise TypeError, "not indexable".
I'm no CGI expert, but I don't see the value of
read_single(). As far as I can tell, it would make sense to
raise TypeError (or perhaps ValueError) at that point with a
message something like, "Data not recognized as a form".
|
|
Date |
User |
Action |
Args |
2008-01-20 09:56:31 | admin | link | issue834840 messages |
2008-01-20 09:56:31 | admin | create | |
|