core (XMLUI): _cleanValue method to avoid issues with DBus types (must be deleted in the future)
This commit is contained in:
parent
da7496c162
commit
c497e19b25
1 changed files with 13 additions and 1 deletions
|
|
@ -151,12 +151,24 @@ def dataFormResult2XMLUI(form_xml, session_id=None):
|
|||
dataFormResult2AdvancedList(xmlui, form_xml)
|
||||
return xmlui
|
||||
|
||||
def _cleanValue(value):
|
||||
"""Workaround method to avoid DBus types with D-Bus bridge
|
||||
|
||||
@param value: value to clean
|
||||
@return: value in a non DBus type (only clean string yet)
|
||||
"""
|
||||
# XXX: must be removed when DBus types will no cause problems anymore
|
||||
# FIXME: should be cleaned inside D-Bus bridge itself
|
||||
if isinstance(value, basestring):
|
||||
return unicode(value)
|
||||
return value
|
||||
|
||||
def XMLUIResult2DataFormResult(xmlui_data):
|
||||
""" Extract form data from a XMLUI return
|
||||
@xmlui_data: data returned by frontends for XMLUI form
|
||||
@return: dict of data usable by Wokkel's dataform
|
||||
"""
|
||||
return {key[len(SAT_FORM_PREFIX):]: value for key, value in xmlui_data.iteritems() if key.startswith(SAT_FORM_PREFIX)}
|
||||
return {key[len(SAT_FORM_PREFIX):]: _cleanValue(value) for key, value in xmlui_data.iteritems() if key.startswith(SAT_FORM_PREFIX)}
|
||||
|
||||
def formEscape(name):
|
||||
""" Return escaped name for forms """
|
||||
|
|
|
|||
Loading…
Reference in a new issue