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
This commit is contained in:
Russell Keith-Magee 2007-09-11 13:36:09 +00:00
parent 7115465afa
commit db01d1d0a8
1 changed files with 4 additions and 1 deletions

View File

@ -38,9 +38,12 @@ class HttpRequest(object):
return d[key] return d[key]
raise KeyError, "%s not found in either POST or GET" % 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 return key in self.GET or key in self.POST
def has_key(self, key):
return key in self
def get_full_path(self): def get_full_path(self):
return '' return ''