summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2016-05-18 09:37:37 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-05-18 09:37:44 +0200
commit4702e7b78fde9845d77c31d32e0de25b0abfb5bc (patch)
tree73635209397bce2cbab3c07a1d63fd87c2cb26a3
parent9dc805a0291230bd8a01931fe6f4e8caabd1afa8 (diff)
downloadpykolab-4702e7b78fde9845d77c31d32e0de25b0abfb5bc.tar.gz
Normalize objectclass attribute values (#5423)
Summary: Fixes objectclass member comparison in cmd-sync #5423 Reviewers: #pykolab_developers, vanmeeuwen Reviewed By: #pykolab_developers, vanmeeuwen Subscribers: vanmeeuwen, vendel.colja Differential Revision: https://git.kolab.org/D156
-rw-r--r--pykolab/utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/pykolab/utils.py b/pykolab/utils.py
index 29a0e95..8bc82e5 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -394,6 +394,17 @@ def normalize(_object):
if not result.has_key('domain') and result.has_key('standard_domain'):
result['domain'] = result['standard_domain']
+ if 'objectclass' not in result:
+ result['objectclass'] = []
+
+ if result['objectclass'] is None:
+ result['objectclass'] = []
+
+ if not isinstance(result['objectclass'], list):
+ result['objectclass'] = [result['objectclass']]
+
+ result['objectclass'] = [x.lower() for x in result['objectclass']]
+
return result
def parse_input(_input, splitchars= [ ' ' ]):