Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhelpful error message from cgi module #39490

Closed
mdcowles mannequin opened this issue Nov 3, 2003 · 3 comments
Closed

Unhelpful error message from cgi module #39490

mdcowles mannequin opened this issue Nov 3, 2003 · 3 comments
Labels
easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@mdcowles
Copy link
Mannequin

mdcowles mannequin commented Nov 3, 2003

BPO 834840
Nosy @akuchling, @orsenthil, @devdanzin, @ezio-melotti, @merwok

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:

assignee = None
closed_at = <Date 2013-11-06.20:22:48.842>
created_at = <Date 2003-11-03.02:54:39.000>
labels = ['easy', 'type-bug', 'library']
title = 'Unhelpful error message from cgi module'
updated_at = <Date 2013-11-06.20:22:48.841>
user = 'https://bugs.python.org/mdcowles'

bugs.python.org fields:

activity = <Date 2013-11-06.20:22:48.841>
actor = 'akuchling'
assignee = 'none'
closed = True
closed_date = <Date 2013-11-06.20:22:48.842>
closer = 'akuchling'
components = ['Library (Lib)']
creation = <Date 2003-11-03.02:54:39.000>
creator = 'mdcowles'
dependencies = []
files = []
hgrepos = []
issue_num = 834840
keywords = ['easy']
message_count = 3.0
messages = ['60415', '109263', '114294']
nosy_count = 6.0
nosy_names = ['akuchling', 'mdcowles', 'orsenthil', 'ajaksu2', 'ezio.melotti', 'eric.araujo']
pr_nums = []
priority = 'low'
resolution = 'wont fix'
stage = 'test needed'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue834840'
versions = ['Python 2.7']

@mdcowles
Copy link
Mannequin Author

mdcowles mannequin commented Nov 3, 2003

[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".

@mdcowles mdcowles mannequin added stdlib Python modules in the Lib dir labels Nov 3, 2003
@devdanzin devdanzin mannequin added type-feature A feature request or enhancement labels Feb 13, 2009
@devdanzin devdanzin mannequin added easy labels Apr 22, 2009
@BreamoreBoy
Copy link
Mannequin

BreamoreBoy mannequin commented Jul 4, 2010

Could a CGI expert pick this up, failing that why not simply close it as opened nearely 7 years ago.

@BreamoreBoy
Copy link
Mannequin

BreamoreBoy mannequin commented Aug 18, 2010

Closed as no reply to msg109263.

@ezio-melotti ezio-melotti added type-bug An unexpected behavior, bug, or error and removed type-feature A feature request or enhancement labels Nov 9, 2012
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants