Mercurial > libervia-backend
changeset 2712:c3f59c1dcb0a
core (memory/disco): normalise booleans in extensions
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 01 Dec 2018 14:40:32 +0100 |
parents | 9adf44996e58 |
children | 19000c506d0c |
files | sat/memory/disco.py |
diffstat | 1 files changed, 8 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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