summaryrefslogtreecommitdiffstats
path: root/pykolab/plugins
diff options
context:
space:
mode:
authorChristoph Erhardt <kolab@sicherha.de>2021-06-05 11:51:27 +0200
committerChristoph Erhardt <kolab@sicherha.de>2022-01-10 20:50:41 +0100
commit9a5f92139d3fbe7fa1945d38198a9cdc74831ac5 (patch)
tree03fff0f479a90dfaa70c6647dd0923086560dcca /pykolab/plugins
parentc3b9d5557161f840a8f2c45fc91ec09299593dd9 (diff)
downloadpykolab-9a5f92139d3fbe7fa1945d38198a9cdc74831ac5.tar.gz
[Python 3] Get rid of .has_key()
Summary: `dict.has_key(key)` was dropped in Python 3.0. Use `key in dict` instead. Reviewers: machniak, mollekopf Reviewed By: mollekopf Differential Revision: https://git.kolab.org/D3241
Diffstat (limited to 'pykolab/plugins')
-rw-r--r--pykolab/plugins/defaultfolders/__init__.py2
-rw-r--r--pykolab/plugins/dynamicquota/__init__.py2
-rw-r--r--pykolab/plugins/recipientpolicy/__init__.py10
-rw-r--r--pykolab/plugins/roundcubedb/__init__.py2
-rw-r--r--pykolab/plugins/sievemgmt/__init__.py24
5 files changed, 20 insertions, 20 deletions
diff --git a/pykolab/plugins/defaultfolders/__init__.py b/pykolab/plugins/defaultfolders/__init__.py
index 0b6ee10..a4a59b0 100644
--- a/pykolab/plugins/defaultfolders/__init__.py
+++ b/pykolab/plugins/defaultfolders/__init__.py
@@ -43,7 +43,7 @@ class KolabDefaultfolders(object):
user_folder - user folder
"""
- if not kw.has_key('additional_folders'):
+ if 'additional_folders' not in kw:
log.error(_("Plugin %s called without required keyword %s.") % ("defaultfolders", "additional_folders"))
return {}
diff --git a/pykolab/plugins/dynamicquota/__init__.py b/pykolab/plugins/dynamicquota/__init__.py
index c9b9b7f..51cb547 100644
--- a/pykolab/plugins/dynamicquota/__init__.py
+++ b/pykolab/plugins/dynamicquota/__init__.py
@@ -53,7 +53,7 @@ class KolabDynamicquota(object):
"""
for keyword in [ 'used', 'imap_quota', 'ldap_quota', 'default_quota' ]:
- if not kw.has_key(keyword):
+ if keyword not in kw:
log.warning(
_("No keyword %s passed to set_user_folder_quota") % (
keyword
diff --git a/pykolab/plugins/recipientpolicy/__init__.py b/pykolab/plugins/recipientpolicy/__init__.py
index 94c707f..330ddfa 100644
--- a/pykolab/plugins/recipientpolicy/__init__.py
+++ b/pykolab/plugins/recipientpolicy/__init__.py
@@ -56,12 +56,12 @@ class KolabRecipientpolicy(object):
user_attrs = utils.normalize(kw['entry'])
- if not user_attrs.has_key('domain'):
+ if 'domain' not in user_attrs:
user_attrs['domain'] = kw['primary_domain']
elif not user_attrs['domain'] == kw['primary_domain']:
user_attrs['domain'] = kw['primary_domain']
- if not user_attrs.has_key('preferredlanguage'):
+ if 'preferredlanguage' not in user_attrs:
default_locale = conf.get(user_attrs['domain'], 'default_locale')
if default_locale == None:
default_locale = conf.get('kolab', 'default_locale')
@@ -77,7 +77,7 @@ class KolabRecipientpolicy(object):
return mail
except KeyError:
log.warning(_("Attribute substitution for 'mail' failed in Recipient Policy"))
- if user_attrs.has_key('mail'):
+ if 'mail' in user_attrs:
return user_attrs['mail']
else:
return None
@@ -96,12 +96,12 @@ class KolabRecipientpolicy(object):
user_attrs = utils.normalize(kw['entry'])
- if not user_attrs.has_key('domain'):
+ if 'domain' not in user_attrs:
user_attrs['domain'] = kw['primary_domain']
elif not user_attrs['domain'] == kw['primary_domain']:
user_attrs['domain'] = kw['primary_domain']
- if not user_attrs.has_key('preferredlanguage'):
+ if 'preferredlanguage' not in user_attrs:
default_locale = conf.get(user_attrs['domain'], 'default_locale')
if default_locale == None:
default_locale = conf.get(user_attrs['domain'], 'default_locale')
diff --git a/pykolab/plugins/roundcubedb/__init__.py b/pykolab/plugins/roundcubedb/__init__.py
index 40271c3..9fe7642 100644
--- a/pykolab/plugins/roundcubedb/__init__.py
+++ b/pykolab/plugins/roundcubedb/__init__.py
@@ -58,7 +58,7 @@ class KolabRoundcubedb(object):
result_attribute = conf.get('cyrus-sasl', 'result_attribute')
# execute Roundcube's bin/deluser.sh script to do the work
- if kw.has_key('user') and kw['user'].has_key(result_attribute) and os.path.exists(rcpath + 'bin/deluser.sh'):
+ if 'user' in kw and result_attribute in kw['user'] and os.path.exists(rcpath + 'bin/deluser.sh'):
proc = subprocess.Popen([ 'sudo -u apache', rcpath + 'bin/deluser.sh', kw['user'][result_attribute] ], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
procout, procerr = proc.communicate()
if proc.returncode != 0:
diff --git a/pykolab/plugins/sievemgmt/__init__.py b/pykolab/plugins/sievemgmt/__init__.py
index 6588bdb..f7e5368 100644
--- a/pykolab/plugins/sievemgmt/__init__.py
+++ b/pykolab/plugins/sievemgmt/__init__.py
@@ -47,7 +47,7 @@ class KolabSievemgmt(object):
user - the user identifier
"""
- if not len(kw) == 1 or not kw.has_key('user'):
+ if not len(kw) == 1 or 'user' not in kw:
log.error(_("Wrong number of arguments for sieve management plugin"))
return
else:
@@ -137,28 +137,28 @@ class KolabSievemgmt(object):
if not vacation_text_attr == None:
- if user.has_key(vacation_active_attr):
+ if vacation_active_attr in user:
vacation_active = utils.true_or_false(user[vacation_active_attr])
else:
vacation_active = False
- if user.has_key(vacation_text_attr):
+ if vacation_text_attr in user:
vacation_text = user[vacation_text_attr]
else:
vacation_active = False
- if user.has_key(vacation_uce_attr):
+ if vacation_uce_attr in user:
vacation_uce = utils.true_or_false(user[vacation_uce_attr])
else:
vacation_uce = False
- if user.has_key(vacation_react_domains_attr):
+ if vacation_react_domains_attr in user:
if isinstance(user[vacation_react_domains_attr], list):
vacation_react_domains = user[vacation_react_domains_attr]
else:
vacation_react_domains = [ user[vacation_react_domains_attr] ]
else:
- if user.has_key(vacation_noreact_domains_attr):
+ if vacation_noreact_domains_attr in user:
if isinstance(user[vacation_noreact_domains_attr], list):
vacation_noreact_domains = user[vacation_noreact_domains_attr]
else:
@@ -171,7 +171,7 @@ class KolabSievemgmt(object):
#
dtf_active_attr = conf.get('sieve', 'deliver_to_folder_active')
if not dtf_active_attr == None:
- if user.has_key(dtf_active_attr):
+ if dtf_active_attr in user:
dtf_active = utils.true_or_false(user[dtf_active_attr])
else:
dtf_active = False
@@ -184,7 +184,7 @@ class KolabSievemgmt(object):
if dtf_active:
dtf_folder_name_attr = conf.get('sieve', 'deliver_to_folder_attr')
if not dtf_folder_name_attr == None:
- if user.has_key(dtf_folder_name_attr):
+ if dtf_folder_name_attr in user:
dtf_folder = user[dtf_folder_name_attr]
else:
log.warning(_("Delivery to folder active, but no folder name attribute available for user %r") % (user))
@@ -216,14 +216,14 @@ class KolabSievemgmt(object):
forward_active_attr = conf.get('sieve', 'forward_address_active')
if not forward_active_attr == None:
- if user.has_key(forward_active_attr):
+ if forward_active_attr in user:
forward_active = utils.true_or_false(user[forward_active_attr])
else:
forward_active = False
if not forward_active == False:
forward_address_attr = conf.get('sieve', 'forward_address_attr')
- if user.has_key(forward_address_attr):
+ if forward_address_attr in user:
if isinstance(user[forward_address_attr], basestring):
forward_addresses = [ user[forward_address_attr] ]
elif isinstance(user[forward_address_attr], str):
@@ -236,14 +236,14 @@ class KolabSievemgmt(object):
forward_keepcopy_attr = conf.get('sieve', 'forward_keepcopy_active')
if not forward_keepcopy_attr == None:
- if user.has_key(forward_keepcopy_attr):
+ if forward_keepcopy_attr in user:
forward_keepcopy = utils.true_or_false(user[forward_keepcopy_attr])
else:
forward_keepcopy = False
forward_uce_attr = conf.get('sieve', 'forward_uce_active')
if not forward_uce_attr == None:
- if user.has_key(forward_uce_attr):
+ if forward_uce_attr in user:
forward_uce = utils.true_or_false(user[forward_uce_attr])
else:
forward_uce = False