diff --git a/django/http/__init__.py b/django/http/__init__.py index 0e1c2a0fbb..20818f138b 100644 --- a/django/http/__init__.py +++ b/django/http/__init__.py @@ -38,11 +38,10 @@ class HttpRequest(object): 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 '' diff --git a/django/template/context.py b/django/template/context.py index 59650b05fe..51cd88b7e9 100644 --- a/django/template/context.py +++ b/django/template/context.py @@ -49,8 +49,7 @@ class Context(object): 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: diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index 4b60d1d194..d96e45b9c8 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -14,9 +14,6 @@ class MergeDict(object): pass raise KeyError - def __contains__(self, key): - return self.has_key(key) - def __copy__(self): return self.__class__(*self.dicts) @@ -45,6 +42,8 @@ class MergeDict(object): if key in dict: return True return False + + __contains__ = has_key def copy(self): """ returns a copy of this object"""