summaryrefslogtreecommitdiffstats
path: root/ucs
diff options
context:
space:
mode:
authorPaul Boddie <paul@boddie.org.uk>2013-12-05 17:17:26 +0100
committerPaul Boddie <paul@boddie.org.uk>2013-12-05 17:17:26 +0100
commit5a1063875a7469b43beb7e197c0751cff9f08f1a (patch)
tree87d5bb70b939d1b6fd317eb4cf41ddfd43090b07 /ucs
parentc5c6c1dff87d2c7a6e457c351eb510303752f725 (diff)
downloadpykolab-5a1063875a7469b43beb7e197c0751cff9f08f1a.tar.gz
Minor import and style-related changes.
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))