summaryrefslogtreecommitdiffstats
path: root/ucs
diff options
context:
space:
mode:
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 1f78bf5..64cb14a 100755
--- a/ucs/kolab_sieve.py
+++ b/ucs/kolab_sieve.py
@@ -76,10 +76,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 old and isinstance(old, dict):
# Either the entry changed or was deleted
- if isinstance(new, dict) and len(new.keys()) > 0:
+ if new and isinstance(new, dict):
# The entry was modified.
result_attr = conf.get('cyrus-sasl', 'result_attribute')
@@ -129,7 +129,7 @@ def handler(*args, **kw):
# Sieve Script Management
return
- elif isinstance(new, dict) and len(new.keys()) > 0:
+ elif new and isinstance(new, dict):
# 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 be7b9e9..ef9b3ea 100755
--- a/ucs/listener.py
+++ b/ucs/listener.py
@@ -82,13 +82,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 old and isinstance(old, dict):
# Two options:
# - entry changed
# - entry deleted
log.info("user %r, old is dict" % (dn))
- if isinstance(new, dict) and len(new.keys()) > 0:
+ if new and isinstance(new, dict):
log.info("Modify entry %r" % (dn))
mailserver_attribute = conf.get('ldap', 'mailserver_attribute').lower()
@@ -159,7 +159,7 @@ def handler(*args, **kw):
entry = old
)
- elif isinstance(new, dict) and len(new.keys()) > 0:
+ elif new and isinstance(new, dict):
# Old is not a dict (or empty), so the entry is just created
log.info("Add entry %r" % (dn))