Feed individual lines of input into the CSV parser, and include all lines in the output.

https://fedorahosted.org/freeipa/ticket/2402

--
PetrĀ³
From 492cbcefc0895630050ed8b19adae4bed26279dd Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Thu, 22 Mar 2012 04:27:48 -0400
Subject: [PATCH 30/31] 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
---
 ipalib/parameters.py |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/ipalib/parameters.py b/ipalib/parameters.py
index ec6020e520fdfb3986d693c805f9f3031fcecd7b..1b676004e2efe9e30984c020ec55cd5b8fcdaa87 100644
--- a/ipalib/parameters.py
+++ b/ipalib/parameters.py
@@ -732,14 +732,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
 
-- 
1.7.7.6

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to