Django 1.10 patch fixes

This commit is contained in:
Andrew Godwin 2016-05-03 18:10:51 -07:00
parent cf9d7d6f76
commit 45dfeb548e
2 changed files with 7 additions and 4 deletions

View File

@ -87,14 +87,16 @@ class AsgiRequest(http.HttpRequest):
self.META[corrected_name] = value
# Pull out request encoding if we find it
if "CONTENT_TYPE" in self.META:
_, content_params = cgi.parse_header(self.META["CONTENT_TYPE"])
if 'charset' in content_params:
self.content_type, self.content_params = cgi.parse_header(self.META["CONTENT_TYPE"])
if 'charset' in self.content_params:
try:
codecs.lookup(content_params['charset'])
codecs.lookup(self.content_params['charset'])
except LookupError:
pass
else:
self.encoding = content_params['charset']
self.encoding = self.content_params['charset']
else:
self.content_type, self.content_params = "", {}
# Pull out content length info
if self.META.get('CONTENT_LENGTH', None):
try:

View File

@ -124,6 +124,7 @@ global_transforms = [
Replacement(r"from django.channels.tests import", r"from django.test.channels import"),
Replacement(r"from django.channels.handler import", r"from django.core.handlers.asgi import"),
Replacement(r"channels.tests.test_routing", r"channels_tests.test_routing"),
Replacement(r"django.core.urlresolvers", r"django.urls"),
]
python_transforms = global_transforms + [