diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py index 21737f682f..50495b4ff3 100644 --- a/django/core/handlers/base.py +++ b/django/core/handlers/base.py @@ -142,7 +142,7 @@ def fix_location_header(request, response): Code constructing response objects is free to insert relative paths and this function converts them to absolute paths. """ - if 'location' in response.headers and http.get_host(request): + if 'Location' in response and http.get_host(request): response['Location'] = request.build_absolute_uri(response['Location']) return response diff --git a/django/http/__init__.py b/django/http/__init__.py index 1bb1621d77..e4aaf5a15f 100644 --- a/django/http/__init__.py +++ b/django/http/__init__.py @@ -273,6 +273,8 @@ class HttpResponse(object): "Case-insensitive check for a header" return self.headers.has_key(header.lower()) + __contains__ = has_header + def set_cookie(self, key, value='', max_age=None, expires=None, path='/', domain=None, secure=None): self.cookies[key] = value for var in ('max_age', 'path', 'domain', 'secure', 'expires'):