# HG changeset patch # User Goffi # Date 1543671632 -3600 # Node ID c3f59c1dcb0a553baf09a480d3f29bfd6f474303 # Parent 9adf44996e5889e4b790c7c1cccfc72b9efecc93 core (memory/disco): normalise booleans in extensions diff -r 9adf44996e58 -r c3f59c1dcb0a sat/memory/disco.py --- a/sat/memory/disco.py Sat Dec 01 14:39:35 2018 +0100 +++ b/sat/memory/disco.py Sat Dec 01 14:40:32 2018 +0100 @@ -392,6 +392,7 @@ entity = jid.JID(entity_jid_s) disco_infos = yield self.getInfos(client, entity, node, use_cache) extensions = {} + # FIXME: should extensions be serialised using tools.common.data_format? for form_type, form in disco_infos.extensions.items(): fields = [] for field in form.fieldList: @@ -402,20 +403,17 @@ data[attr] = value values = [field.value] if field.value is not None else field.values + if field.fieldType == u"boolean": + values = [C.boolConst(C.bool(v)) for v in values] fields.append((data, values)) extensions[form_type or ""] = fields - defer.returnValue( - ( - disco_infos.features, - [ - (cat, type_, name or "") - for (cat, type_), name in disco_infos.identities.items() - ], - extensions, - ) - ) + defer.returnValue(( + disco_infos.features, + [(cat, type_, name or "") + for (cat, type_), name in disco_infos.identities.items()], + extensions)) def items2tuples(self, disco_items): """convert disco items to tuple of strings