From bff9101a9fe8eecbe01d9aa33808363f6ed8b3fa Mon Sep 17 00:00:00 2001 From: Martin Kosek Date: Jan 12 2012 09:45:27 +0000 Subject: Fix Parameter csv parsing CSV values were not parsed in ipalib.parameters.normalize method properly when passed as a list and not as a basestring. Based on Jan Cholasta's contribution. --- diff --git a/ipalib/parameters.py b/ipalib/parameters.py index 287304d..22144b7 100644 --- a/ipalib/parameters.py +++ b/ipalib/parameters.py @@ -711,11 +711,17 @@ class Param(ReadOnly): :param value: A proposed value for this parameter. """ if self.multivalue: - if self.csv and isinstance(value, basestring): - csvreader = self.__unicode_csv_reader([unicode(value)]) - value = tuple(csvreader.next()) #pylint: disable=E1101 - elif type(value) not in (tuple, list): + if type(value) not in (tuple, list): value = (value,) + if self.csv: + newval = () + for v in value: + if isinstance(v, basestring): + csvreader = self.__unicode_csv_reader([unicode(v)]) + newval += tuple(csvreader.next()) #pylint: disable=E1101 + else: + newval += (v,) + value = newval if self.normalizer is None: return value if self.multivalue: