Skip to content

Commit d0d5dc6

Browse files
committed
[1.3.x] Fixed django#18692 -- Restored python 2.4 compatibility.
Thanks to chipx86 for the report.
1 parent e2ac917 commit d0d5dc6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

django/http/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,8 @@ class HttpResponseRedirectBase(HttpResponse):
642642
def __init__(self, redirect_to):
643643
super(HttpResponseRedirectBase, self).__init__()
644644
parsed = urlparse(redirect_to)
645-
if parsed.scheme and parsed.scheme not in self.allowed_schemes:
646-
raise SuspiciousOperation("Unsafe redirect to URL with scheme '%s'" % parsed.scheme)
645+
if parsed[0] and parsed[0] not in self.allowed_schemes:
646+
raise SuspiciousOperation("Unsafe redirect to URL with scheme '%s'" % parsed[0])
647647
self['Location'] = iri_to_uri(redirect_to)
648648

649649
class HttpResponseRedirect(HttpResponseRedirectBase):

django/http/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def fix_IE_for_vary(request, response):
7676

7777
# The first part of the Content-Type field will be the MIME type,
7878
# everything after ';', such as character-set, can be ignored.
79-
mime_type = response.get('Content-Type', '').partition(';')[0]
79+
mime_type = response.get('Content-Type', '').split(';', 1)[0]
8080
if mime_type not in safe_mime_types:
8181
try:
8282
del response['Vary']

0 commit comments

Comments
 (0)