Mercurial > libervia-backend
comparison sat/tools/xml_tools.py @ 2938:48985ef7682f
tools (xml_tools): split new lines for multi-lines text in XMLUIResult2DataFormResult to be correctly handled in data form
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 03 May 2019 20:48:19 +0200 |
parents | 777a582d9641 |
children | e2cb04b381bb |
comparison
equal
deleted
inserted
replaced
2937:db0890c9c7db | 2938:48985ef7682f |
---|---|
333 """ Extract form data from a XMLUI return. | 333 """ Extract form data from a XMLUI return. |
334 | 334 |
335 @param xmlui_data (dict): data returned by frontends for XMLUI form | 335 @param xmlui_data (dict): data returned by frontends for XMLUI form |
336 @return: dict of data usable by Wokkel's data form | 336 @return: dict of data usable by Wokkel's data form |
337 """ | 337 """ |
338 return { | 338 ret = {} |
339 key[len(SAT_FORM_PREFIX) :]: _cleanValue(value) | 339 for key, value in xmlui_data.iteritems(): |
340 for key, value in xmlui_data.iteritems() | 340 if not key.startswith(SAT_FORM_PREFIX): |
341 if key.startswith(SAT_FORM_PREFIX) | 341 continue |
342 } | 342 if isinstance(value, basestring) and u'\n' in value: |
343 # data form expects multi-lines text to be in separated values | |
344 value = value.split(u'\n') | |
345 ret[key[len(SAT_FORM_PREFIX) :]] = _cleanValue(value) | |
346 return ret | |
343 | 347 |
344 | 348 |
345 def formEscape(name): | 349 def formEscape(name): |
346 """Return escaped name for forms. | 350 """Return escaped name for forms. |
347 | 351 |