summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-04-26 13:30:48 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-04-26 13:30:48 +0000
commit439cb4047fb583d08149f28e2ce66a8edfe0efa7 (patch)
tree47ef30e70bf1d757f08b133d3aa47704db13c714 /django/utils
parent6c02565e4fb92c4cc3bfb45bcc89eb9aa299efdc (diff)
Fixed #4040 -- Changed uses of has_key() to "in". Slight performance
improvement and forward-compatible with future Python releases. Patch from Gary Wilson. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/datastructures.py2
-rw-r--r--django/utils/functional.py2
-rw-r--r--django/utils/translation/trans_real.py2
3 files changed, 3 insertions, 3 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index cca30b462d..60bc0051a2 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -42,7 +42,7 @@ class MergeDict(object):
def has_key(self, key):
for dict in self.dicts:
- if dict.has_key(key):
+ if key in dict:
return True
return False
diff --git a/django/utils/functional.py b/django/utils/functional.py
index e3c0a3c76b..0c31c1f375 100644
--- a/django/utils/functional.py
+++ b/django/utils/functional.py
@@ -42,7 +42,7 @@ def lazy(func, *resultclasses):
res = self.__func(*self.__args, **self.__kw)
return self.__dispatch[type(res)][funcname](res, *args, **kw)
- if not self.__dispatch.has_key(klass):
+ if klass not in self.__dispatch:
self.__dispatch[klass] = {}
self.__dispatch[klass][funcname] = func
return __wrapper__
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
index 0c8dcd540f..293b4ef9cd 100644
--- a/django/utils/translation/trans_real.py
+++ b/django/utils/translation/trans_real.py
@@ -199,7 +199,7 @@ def deactivate():
will resolve against the default translation object, again.
"""
global _active
- if _active.has_key(currentThread()):
+ if currentThread() in _active:
del _active[currentThread()]
def get_language():