# HG changeset patch # User Goffi # Date 1492453872 -7200 # Node ID 6856b7225c5b2d90fb2a7df1b9717016943c5e73 # Parent 301bb52c8715f72975a45d22a618695c99849adb plugin XEP-0060: getNodeAffiliations use jid.JID as keys instead of jids as unicode diff -r 301bb52c8715 -r 6856b7225c5b src/plugins/plugin_xep_0060.py --- a/src/plugins/plugin_xep_0060.py Sun Apr 16 18:00:45 2017 +0200 +++ b/src/plugins/plugin_xep_0060.py Mon Apr 17 20:31:12 2017 +0200 @@ -483,6 +483,7 @@ def _getNodeAffiliations(self, service_s, nodeIdentifier, profile_key): client = self.host.getClient(profile_key) d = self.getNodeAffiliations(client, jid.JID(service_s) if service_s else None, nodeIdentifier) + d.addCallback(lambda affiliations: {j.full(): a for j, a in affiliations.iteritems()}) return d def getNodeAffiliations(self, client, service, nodeIdentifier): @@ -497,7 +498,7 @@ except StopIteration: raise ValueError(_(u"Invalid result: missing element: {}").format(iq_elt.toXml)) try: - return {e['jid']: e['affiliation'] for e in affiliations_elt.elements((pubsub.NS_PUBSUB_OWNER, 'affiliation'))} + return {jid.JID(e['jid']): e['affiliation'] for e in affiliations_elt.elements((pubsub.NS_PUBSUB_OWNER, 'affiliation'))} except KeyError: raise ValueError(_(u"Invalid result: bad element: {}").format(iq_elt.toXml))