summaryrefslogtreecommitdiffstats
path: root/ucs
diff options
context:
space:
mode:
authorChristoph Erhardt <kolab@sicherha.de>2021-06-05 09:59:24 +0200
committerChristoph Erhardt <kolab@sicherha.de>2022-01-10 20:48:40 +0100
commitc3b9d5557161f840a8f2c45fc91ec09299593dd9 (patch)
tree93105906638753c8d040af85226f30ae63963cbf /ucs
parent991255eaa314b51e2dd586460311d4633a56eb86 (diff)
downloadpykolab-c3b9d5557161f840a8f2c45fc91ec09299593dd9.tar.gz
[Python 3] Remove unnecessary occurrences of .keys()
Summary: The following cases are covered: * for key in dict * if key in dict * len(dict) This will make life easier for futurize. Reviewers: machniak, mollekopf Reviewed By: mollekopf Differential Revision: https://git.kolab.org/D3235
Diffstat (limited to 'ucs')
-rwxr-xr-xucs/kolab_sieve.py6
-rwxr-xr-xucs/listener.py6
2 files changed, 6 insertions, 6 deletions
diff --git a/ucs/kolab_sieve.py b/ucs/kolab_sieve.py
index d7125a7..70ae4b8 100755
--- a/ucs/kolab_sieve.py
+++ b/ucs/kolab_sieve.py
@@ -77,10 +77,10 @@ def handler(*args, **kw):
new = utils.normalize(args[1])
old = utils.normalize(args[2])
- if isinstance(old, dict) and len(old.keys()) > 0:
+ if isinstance(old, dict) and len(old) > 0:
# Either the entry changed or was deleted
- if isinstance(new, dict) and len(new.keys()) > 0:
+ if isinstance(new, dict) and len(new) > 0:
# The entry was modified.
result_attr = conf.get('cyrus-sasl', 'result_attribute')
@@ -128,7 +128,7 @@ def handler(*args, **kw):
# Sieve Script Management
return
- elif isinstance(new, dict) and len(new.keys()) > 0:
+ elif isinstance(new, dict) and len(new) > 0:
# Old is not a dict (or empty), so the entry is just created
# See if the mailserver_attribute exists
diff --git a/ucs/listener.py b/ucs/listener.py
index 67c3dca..a36075f 100755
--- a/ucs/listener.py
+++ b/ucs/listener.py
@@ -83,13 +83,13 @@ def handler(*args, **kw):
new = utils.normalize(args[1])
old = utils.normalize(args[2])
- if isinstance(old, dict) and len(old.keys()) > 0:
+ if isinstance(old, dict) and len(old) > 0:
# Two options:
# - entry changed
# - entry deleted
log.info("user %r, old is dict" % (dn))
- if isinstance(new, dict) and len(new.keys()) > 0:
+ if isinstance(new, dict) and len(new) > 0:
log.info("Modify entry %r" % (dn))
mailserver_attribute = conf.get('ldap', 'mailserver_attribute').lower()
@@ -160,7 +160,7 @@ def handler(*args, **kw):
entry=old
)
- elif isinstance(new, dict) and len(new.keys()) > 0:
+ elif isinstance(new, dict) and len(new) > 0:
# Old is not a dict (or empty), so the entry is just created
log.info("Add entry %r" % (dn))