mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes. Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702 git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -49,7 +49,7 @@ class ModPythonRequest(http.HttpRequest):
|
||||
if 'content-type' in self._req.headers_in and self._req.headers_in['content-type'].startswith('multipart'):
|
||||
self._post, self._files = http.parse_file_upload(self._req.headers_in, self.raw_post_data)
|
||||
else:
|
||||
self._post, self._files = http.QueryDict(self.raw_post_data), datastructures.MultiValueDict()
|
||||
self._post, self._files = http.QueryDict(self.raw_post_data, encoding=self._encoding), datastructures.MultiValueDict()
|
||||
|
||||
def _get_request(self):
|
||||
if not hasattr(self, '_request'):
|
||||
@@ -58,7 +58,7 @@ class ModPythonRequest(http.HttpRequest):
|
||||
|
||||
def _get_get(self):
|
||||
if not hasattr(self, '_get'):
|
||||
self._get = http.QueryDict(self._req.args)
|
||||
self._get = http.QueryDict(self._req.args, encoding=self._encoding)
|
||||
return self._get
|
||||
|
||||
def _set_get(self, get):
|
||||
@@ -160,7 +160,7 @@ class ModPythonHandler(BaseHandler):
|
||||
req.content_type = response['Content-Type']
|
||||
for key, value in response.headers.items():
|
||||
if key != 'Content-Type':
|
||||
req.headers_out[key] = value
|
||||
req.headers_out[str(key)] = str(value)
|
||||
for c in response.cookies.values():
|
||||
req.headers_out.add('Set-Cookie', c.output(header=''))
|
||||
req.status = response.status_code
|
||||
|
||||
@@ -113,9 +113,9 @@ class WSGIRequest(http.HttpRequest):
|
||||
header_dict['Content-Type'] = self.environ.get('CONTENT_TYPE', '')
|
||||
self._post, self._files = http.parse_file_upload(header_dict, self.raw_post_data)
|
||||
else:
|
||||
self._post, self._files = http.QueryDict(self.raw_post_data), datastructures.MultiValueDict()
|
||||
self._post, self._files = http.QueryDict(self.raw_post_data, encoding=self._encoding), datastructures.MultiValueDict()
|
||||
else:
|
||||
self._post, self._files = http.QueryDict(''), datastructures.MultiValueDict()
|
||||
self._post, self._files = http.QueryDict('', encoding=self._encoding), datastructures.MultiValueDict()
|
||||
|
||||
def _get_request(self):
|
||||
if not hasattr(self, '_request'):
|
||||
@@ -125,7 +125,7 @@ class WSGIRequest(http.HttpRequest):
|
||||
def _get_get(self):
|
||||
if not hasattr(self, '_get'):
|
||||
# The WSGI spec says 'QUERY_STRING' may be absent.
|
||||
self._get = http.QueryDict(self.environ.get('QUERY_STRING', ''))
|
||||
self._get = http.QueryDict(self.environ.get('QUERY_STRING', ''), encoding=self._encoding)
|
||||
return self._get
|
||||
|
||||
def _set_get(self, get):
|
||||
@@ -200,8 +200,8 @@ class WSGIHandler(BaseHandler):
|
||||
except KeyError:
|
||||
status_text = 'UNKNOWN STATUS CODE'
|
||||
status = '%s %s' % (response.status_code, status_text)
|
||||
response_headers = response.headers.items()
|
||||
response_headers = [(str(k), str(v)) for k, v in response.headers.items()]
|
||||
for c in response.cookies.values():
|
||||
response_headers.append(('Set-Cookie', c.output(header='')))
|
||||
response_headers.append(('Set-Cookie', str(c.output(header=''))))
|
||||
start_response(status, response_headers)
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user