diff options
author | Petr Viktorin <pviktori@redhat.com> | 2012-03-22 04:27:48 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2012-03-28 22:01:24 -0400 |
commit | 0b62700c8ca46cf41e2cd53ea9154ae558019a05 (patch) | |
tree | a8147612f969070e1f83fdea329eaa5556ef49ab /ipalib/parameters.py | |
parent | 18a6ab356a159a88c5aab014f344eb14a9d38c81 (diff) | |
download | freeipa-0b62700c8ca46cf41e2cd53ea9154ae558019a05.tar.gz freeipa-0b62700c8ca46cf41e2cd53ea9154ae558019a05.tar.xz freeipa-0b62700c8ca46cf41e2cd53ea9154ae558019a05.zip |
Allow multi-line CSV parameters
Feed individual lines of input into the CSV parser, and include all lines
in the output.
https://fedorahosted.org/freeipa/ticket/2402
Diffstat (limited to 'ipalib/parameters.py')
-rw-r--r-- | ipalib/parameters.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ipalib/parameters.py b/ipalib/parameters.py index 5040234a..60fb5023 100644 --- a/ipalib/parameters.py +++ b/ipalib/parameters.py @@ -715,14 +715,15 @@ class Param(ReadOnly): if self.csv: if type(value) not in (tuple, list): value = (value,) - newval = () + newval = [] for v in value: if isinstance(v, basestring): - csvreader = self.__unicode_csv_reader([unicode(v)]) - newval += tuple(csvreader.next()) #pylint: disable=E1101 + lines = unicode(v).splitlines() + for row in self.__unicode_csv_reader(lines): + newval.extend(row) else: - newval += (v,) - return newval + newval.append(v) + return tuple(newval) else: return value |