Fixed #9585 -- Corrected code committed in [9398] that wasn't compatible with Python 2.3/2.4. Thanks to Karen Tracey for the report and fix.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9465 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2008-11-16 08:20:25 +00:00
parent 21e86f2af2
commit 98ec741a03
1 changed files with 12 additions and 12 deletions

View File

@ -264,8 +264,8 @@ class Client(object):
parsed = urlparse(path) parsed = urlparse(path)
r = { r = {
'CONTENT_TYPE': 'text/html; charset=utf-8', 'CONTENT_TYPE': 'text/html; charset=utf-8',
'PATH_INFO': urllib.unquote(parsed.path), 'PATH_INFO': urllib.unquote(parsed[2]),
'QUERY_STRING': urlencode(data, doseq=True) or parsed.query, 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4],
'REQUEST_METHOD': 'GET', 'REQUEST_METHOD': 'GET',
'wsgi.input': FakePayload('') 'wsgi.input': FakePayload('')
} }
@ -286,8 +286,8 @@ class Client(object):
r = { r = {
'CONTENT_LENGTH': len(post_data), 'CONTENT_LENGTH': len(post_data),
'CONTENT_TYPE': content_type, 'CONTENT_TYPE': content_type,
'PATH_INFO': urllib.unquote(parsed.path), 'PATH_INFO': urllib.unquote(parsed[2]),
'QUERY_STRING': parsed.query, 'QUERY_STRING': parsed[4],
'REQUEST_METHOD': 'POST', 'REQUEST_METHOD': 'POST',
'wsgi.input': FakePayload(post_data), 'wsgi.input': FakePayload(post_data),
} }
@ -302,8 +302,8 @@ class Client(object):
parsed = urlparse(path) parsed = urlparse(path)
r = { r = {
'CONTENT_TYPE': 'text/html; charset=utf-8', 'CONTENT_TYPE': 'text/html; charset=utf-8',
'PATH_INFO': urllib.unquote(parsed.path), 'PATH_INFO': urllib.unquote(parsed[2]),
'QUERY_STRING': urlencode(data, doseq=True) or parsed.query, 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4],
'REQUEST_METHOD': 'HEAD', 'REQUEST_METHOD': 'HEAD',
'wsgi.input': FakePayload('') 'wsgi.input': FakePayload('')
} }
@ -317,8 +317,8 @@ class Client(object):
""" """
parsed = urlparse(path) parsed = urlparse(path)
r = { r = {
'PATH_INFO': urllib.unquote(parsed.path), 'PATH_INFO': urllib.unquote(parsed[2]),
'QUERY_STRING': urlencode(data, doseq=True) or parsed.query, 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4],
'REQUEST_METHOD': 'OPTIONS', 'REQUEST_METHOD': 'OPTIONS',
'wsgi.input': FakePayload('') 'wsgi.input': FakePayload('')
} }
@ -339,8 +339,8 @@ class Client(object):
r = { r = {
'CONTENT_LENGTH': len(post_data), 'CONTENT_LENGTH': len(post_data),
'CONTENT_TYPE': content_type, 'CONTENT_TYPE': content_type,
'PATH_INFO': urllib.unquote(parsed.path), 'PATH_INFO': urllib.unquote(parsed[2]),
'QUERY_STRING': urlencode(data, doseq=True) or parsed.query, 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4],
'REQUEST_METHOD': 'PUT', 'REQUEST_METHOD': 'PUT',
'wsgi.input': FakePayload(post_data), 'wsgi.input': FakePayload(post_data),
} }
@ -354,8 +354,8 @@ class Client(object):
""" """
parsed = urlparse(path) parsed = urlparse(path)
r = { r = {
'PATH_INFO': urllib.unquote(parsed.path), 'PATH_INFO': urllib.unquote(parsed[2]),
'QUERY_STRING': urlencode(data, doseq=True) or parsed.query, 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4],
'REQUEST_METHOD': 'DELETE', 'REQUEST_METHOD': 'DELETE',
'wsgi.input': FakePayload('') 'wsgi.input': FakePayload('')
} }