[Python-bugs-list] [ python-Bugs-569316 ] cgi.py broken with xmlrpclib on Python 2
noreply@sourceforge.net
noreply@sourceforge.net
Sat, 15 Jun 2002 01:53:45 -0700
Bugs item #569316, was opened at 2002-06-15 10:53
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=569316&group_id=5470
Category: Python Library
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Steve Pike (oztourer)
Assigned to: Nobody/Anonymous (nobody)
Summary: cgi.py broken with xmlrpclib on Python 2
Initial Comment:
Given a web application which accepts both normal
HTTP requests and XML-RPC requests, it is
reasonable for that program to assume it can create a
cgi.FieldStorage instance in either case. This works
fine in Python 1.5.2 but causes exceptions in Python
2.x.x when using the created FieldStorage. This is due
to the content-type header generated by xmlrpclib.py
('text/xml') being unrecognised in cgi.py, as a result of
which no FieldStorage.list is created.
One solution is to reinstate some code in cgi.py from
the 1.5.2 release, at the end of method __init__, after
removing the current final two lines:
#else:
# self.read_single()
# SP 2002/6/15: The following code is taken
from the Python 1.5.2 version
# of cgi.py, as incoming xmlrpclib requests
otherwise do not cause 'list'
# to be set up correctly.
elif self.outerboundary:
# we're in an inner part, but the content-type
wasn't something we
# understood. default to read_single()
because the resulting
# FieldStorage won't be a mapping (and
doesn't need to be).
self.read_single()
else:
# we're in an outer part, but the content-type
wasn't something we
# understood. we still want the resulting
FieldStorage to be a
# mapping, so parse it as if it were urlencoded
self.read_urlencoded()
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=569316&group_id=5470