summaryrefslogtreecommitdiffstats
path: root/pykolab
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:37 +0200
commite7bbf664076622b2a4dc51d492298cd5d984f8fb (patch)
tree79c96ead6ba46e937a8f57b478f647d24b1fb751 /pykolab
parent8656c58bd78614f99fa4baca995a3ac03cb49e8e (diff)
downloadpykolab-e7bbf664076622b2a4dc51d492298cd5d984f8fb.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
Diffstat (limited to 'pykolab')
-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= [ ' ' ]):