From d0d5dc6cd76f01c8a71b677357ad2f702cb54416 Mon Sep 17 00:00:00 2001 From: Florian Apolloner Date: Wed, 1 Aug 2012 10:56:35 +0200 Subject: [PATCH] [1.3.x] Fixed #18692 -- Restored python 2.4 compatibility. Thanks to chipx86 for the report. --- django/http/__init__.py | 4 ++-- django/http/utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/django/http/__init__.py b/django/http/__init__.py index 74113b080a..2dfe12ee4b 100644 --- a/django/http/__init__.py +++ b/django/http/__init__.py @@ -642,8 +642,8 @@ class HttpResponseRedirectBase(HttpResponse): def __init__(self, redirect_to): super(HttpResponseRedirectBase, self).__init__() parsed = urlparse(redirect_to) - if parsed.scheme and parsed.scheme not in self.allowed_schemes: - raise SuspiciousOperation("Unsafe redirect to URL with scheme '%s'" % parsed.scheme) + if parsed[0] and parsed[0] not in self.allowed_schemes: + raise SuspiciousOperation("Unsafe redirect to URL with scheme '%s'" % parsed[0]) self['Location'] = iri_to_uri(redirect_to) class HttpResponseRedirect(HttpResponseRedirectBase): diff --git a/django/http/utils.py b/django/http/utils.py index 01808648ba..3fdebf0474 100644 --- a/django/http/utils.py +++ b/django/http/utils.py @@ -76,7 +76,7 @@ def fix_IE_for_vary(request, response): # The first part of the Content-Type field will be the MIME type, # everything after ';', such as character-set, can be ignored. - mime_type = response.get('Content-Type', '').partition(';')[0] + mime_type = response.get('Content-Type', '').split(';', 1)[0] if mime_type not in safe_mime_types: try: del response['Vary']