# HG changeset patch # User Goffi # Date 1396880555 -7200 # Node ID 58a57ce5932a93577749d6a3321188f897f06049 # Parent f0bba18835efcef5cfc18f759ac06fa8096b8162 core (XMLUI): _cleanValue method to avoid issues with DBus types (must be deleted in the future) diff -r f0bba18835ef -r 58a57ce5932a src/tools/xml_tools.py --- a/src/tools/xml_tools.py Mon Apr 07 16:22:35 2014 +0200 +++ b/src/tools/xml_tools.py Mon Apr 07 16:22:35 2014 +0200 @@ -151,12 +151,24 @@ 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 """