From e8e274c9e0a9fb9d2ef775f99c763d97b23050b1 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 8 Dec 2010 13:26:27 -0500 Subject: Properly handle multi-valued attributes when using setattr/addattr. The problem was that the normalizer was returning each value as a tuple which we were then appending to a list, so it looked like [(u'value1',), (u'value2',),...]. If there was a single value we could end up adding a tuple to a list which would fail. Additionally python-ldap doesn't like lists of lists so it was failing later in the process as well. I've added some simple tests for setattr and addattr. ticket 565 --- ipalib/plugins/baseldap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ipalib/plugins') diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py index 6b7153b5..3299f801 100644 --- a/ipalib/plugins/baseldap.py +++ b/ipalib/plugins/baseldap.py @@ -700,7 +700,7 @@ class LDAPUpdate(LDAPQuery, crud.Update): for a in old_entry: if not isinstance(entry_attrs[a], (list, tuple)): entry_attrs[a] = [entry_attrs[a]] - entry_attrs[a] += old_entry[a] + entry_attrs[a] = list(entry_attrs[a]) + old_entry[a] if options.get('all', False): attrs_list = ['*'] + self.obj.default_attributes -- cgit