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
This commit is contained in:
Petr Viktorin 2012-03-22 04:27:48 -04:00 committed by Rob Crittenden
parent 18a6ab356a
commit 0b62700c8c

View File

@ -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