From 7d8d9c8ccb825295fe076745fbe974d50157f88d Mon Sep 17 00:00:00 2001 From: Goffi Date: Fri, 3 May 2019 20:48:19 +0200 Subject: [PATCH] tools (xml_tools): split new lines for multi-lines text in XMLUIResult2DataFormResult to be correctly handled in data form --- sat/tools/xml_tools.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sat/tools/xml_tools.py b/sat/tools/xml_tools.py index 0e65a4f7..10190bdc 100644 --- a/sat/tools/xml_tools.py +++ b/sat/tools/xml_tools.py @@ -335,11 +335,15 @@ def XMLUIResult2DataFormResult(xmlui_data): @param xmlui_data (dict): data returned by frontends for XMLUI form @return: dict of data usable by Wokkel's data form """ - return { - key[len(SAT_FORM_PREFIX) :]: _cleanValue(value) - for key, value in xmlui_data.iteritems() - if key.startswith(SAT_FORM_PREFIX) - } + ret = {} + for key, value in xmlui_data.iteritems(): + if not key.startswith(SAT_FORM_PREFIX): + continue + if isinstance(value, basestring) and u'\n' in value: + # data form expects multi-lines text to be in separated values + value = value.split(u'\n') + ret[key[len(SAT_FORM_PREFIX) :]] = _cleanValue(value) + return ret def formEscape(name):