tools (xml_tools): split new lines for multi-lines text in XMLUIResult2DataFormResult to be correctly handled in data form

This commit is contained in:
Goffi 2019-05-03 20:48:19 +02:00
commit 7d8d9c8ccb

View file

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