1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #333 and #440 -- Split DEFAULT_MIME_TYPE setting into DEFAULT_CONTENT_TYPE and DEFAULT_CHARSET. Thanks, Maniac.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@786 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty
2005-10-06 02:27:08 +00:00
parent 261ab166ce
commit ab9aacd4db
9 changed files with 22 additions and 16 deletions

View File

@@ -150,14 +150,15 @@ class ModPythonHandler(BaseHandler):
def populate_apache_request(http_response, mod_python_req):
"Populates the mod_python request object with an HttpResponse"
mod_python_req.content_type = http_response['Content-Type'] or httpwrappers.DEFAULT_MIME_TYPE
from django.conf import settings
mod_python_req.content_type = http_response['Content-Type']
for key, value in http_response.headers.items():
if key != 'Content-Type':
mod_python_req.headers_out[key] = value
for c in http_response.cookies.values():
mod_python_req.headers_out.add('Set-Cookie', c.output(header=''))
mod_python_req.status = http_response.status_code
mod_python_req.write(http_response.get_content_as_string('utf-8'))
mod_python_req.write(http_response.get_content_as_string(settings.DEFAULT_CHARSET))
def handler(req):
# mod_python hooks into this function.

View File

@@ -167,6 +167,6 @@ class WSGIHandler(BaseHandler):
response_headers = response.headers.items()
for c in response.cookies.values():
response_headers.append(('Set-Cookie', c.output(header='')))
output = [response.get_content_as_string('utf-8')]
output = [response.get_content_as_string(settings.DEFAULT_CHARSET)]
start_response(status, response_headers)
return output