Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refs #5138 -- Refactored implementation of __contains__ in HttpReques…

…t introduced in [6097] after a suggestion from Malcolm. Applied a similar refactor for MergeDict and Context which had comparable behavior.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 50497e3867564e68050d326b22dc41fe82d79dc0 1 parent db01d1d
@freakboy3742 freakboy3742 authored
5 django/http/
@@ -38,11 +38,10 @@ def __getitem__(self, key):
return d[key]
raise KeyError, "%s not found in either POST or GET" % key
- def __contains__(self, key):
+ def has_key(self, key):
return key in self.GET or key in self.POST
- def has_key(self, key):
- return key in self
+ __contains__ = has_key
def get_full_path(self):
return ''
3  django/template/
@@ -49,8 +49,7 @@ def has_key(self, key):
return True
return False
- def __contains__(self, key):
- return self.has_key(key)
+ __contains__ = has_key
def get(self, key, otherwise=None):
for d in self.dicts:
5 django/utils/
@@ -14,9 +14,6 @@ def __getitem__(self, key):
raise KeyError
- def __contains__(self, key):
- return self.has_key(key)
def __copy__(self):
return self.__class__(*self.dicts)
@@ -45,6 +42,8 @@ def has_key(self, key):
if key in dict:
return True
return False
+ __contains__ = has_key
def copy(self):
""" returns a copy of this object"""
Please sign in to comment.
Something went wrong with that request. Please try again.