You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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".
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: