From 4100eab823202a26a7b8227d9b2d1a8c7811c1d7 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Fri, 14 Sep 2007 21:41:48 +0000 Subject: [PATCH] Fixed the breakage in [6164] in a different, better way: HttpResponse now implements __contains__ along with __get/set/delitem__, as it should. This is a bit more robust, and should prevent similar breakage from user code. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6221 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/handlers/base.py | 2 +- django/http/__init__.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py index 21737f682f1..50495b4ff34 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 1bb1621d77e..e4aaf5a15f5 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'):