diff options
author | Petr Viktorin <pviktori@redhat.com> | 2015-07-30 17:29:39 +0200 |
---|---|---|
committer | Tomas Babej <tbabej@redhat.com> | 2015-08-12 18:17:23 +0200 |
commit | 6a741b51dac6efd650f2427604bd54cbf300f761 (patch) | |
tree | 2a1ebde55d64a6e2f3c33d1cc8c1ce64f73570f7 /ipapython/ipautil.py | |
parent | 8b88caa110e83b42b1e43189c06b6cb3de712353 (diff) | |
download | freeipa-6a741b51dac6efd650f2427604bd54cbf300f761.tar.gz freeipa-6a741b51dac6efd650f2427604bd54cbf300f761.tar.xz freeipa-6a741b51dac6efd650f2427604bd54cbf300f761.zip |
Replace dict.has_key with the 'in' operator
The deprecated has_key method will be removed from dicts in Python 3.
For custom dict-like classes, has_key() is kept on Python 2,
but disabled for Python 3.
Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'ipapython/ipautil.py')
-rw-r--r-- | ipapython/ipautil.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py index 280858ce7..ba8312e79 100644 --- a/ipapython/ipautil.py +++ b/ipapython/ipautil.py @@ -544,8 +544,9 @@ class CIDict(dict): def __contains__(self, key): return super(CIDict, self).__contains__(key.lower()) - def has_key(self, key): - return super(CIDict, self).has_key(key.lower()) + if sys.version_info < (3, 0): + def has_key(self, key): + return super(CIDict, self).has_key(key.lower()) def get(self, key, failobj=None): try: |