From 9ecbd845d47231c742e46f04c98856ff672fdd81 Mon Sep 17 00:00:00 2001 From: Pavel Zuna Date: Tue, 21 Apr 2009 15:17:07 +0200 Subject: Add conditional (env.use_ldap2 is True) modifications required by new LDAP backend. --- ipalib/frontend.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'ipalib/frontend.py') diff --git a/ipalib/frontend.py b/ipalib/frontend.py index db045fe6..c2f68d47 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -184,12 +184,21 @@ class Command(plugable.Plugin): return dict(self.__attributes_2_entry(kw)) def __attributes_2_entry(self, kw): - for name in self.params: - if self.params[name].attribute and name in kw: - if type(kw[name]) is tuple: - yield (name, [str(value) for value in kw[name]]) - else: - yield (name, str(kw[name])) + if self.api.env.use_ldap2: + for name in self.params: + if self.params[name].attribute and name in kw: + value = kw[name] + if isinstance(value, tuple): + yield (name, [v for v in value]) + else: + yield (name, kw[name]) + else: + for name in self.params: + if self.params[name].attribute and name in kw: + if type(kw[name]) is tuple: + yield (name, [str(value) for value in kw[name]]) + else: + yield (name, str(kw[name])) def params_2_args_options(self, **params): """ -- cgit