From db01d1d0a8b1d584b025164988de8003c2d29d1c Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 11 Sep 2007 13:36:09 +0000 Subject: [PATCH] Fixed #5318 -- Added __contains__ method to HttpRequest, mirroring existing has_key method. Thanks for the patch, robbie@prelab.net. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6097 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/http/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/django/http/__init__.py b/django/http/__init__.py index 7cd47481dc..0e1c2a0fbb 100644 --- a/django/http/__init__.py +++ b/django/http/__init__.py @@ -38,9 +38,12 @@ class HttpRequest(object): return d[key] raise KeyError, "%s not found in either POST or GET" % key - def has_key(self, key): + def __contains__(self, key): return key in self.GET or key in self.POST + def has_key(self, key): + return key in self + def get_full_path(self): return ''