Mercurial > libervia-backend
comparison sat_frontends/jp/base.py @ 3765:ea204216a505
CLI: don't fail when calling `getContacts` with a component profile
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 13 May 2022 19:15:30 +0200 |
parents | 09f5ac48ffe3 |
children | 3260401fdb98 |
comparison
equal
deleted
inserted
replaced
3764:125c7043b277 | 3765:ea204216a505 |
---|---|
799 | 799 |
800 """ | 800 """ |
801 names2jid = {} | 801 names2jid = {} |
802 nodes2jid = {} | 802 nodes2jid = {} |
803 | 803 |
804 for contact in await self.bridge.getContacts(self.profile): | 804 try: |
805 contacts = await self.bridge.getContacts(self.profile) | |
806 except BridgeException as e: | |
807 if e.classname == "AttributeError": | |
808 # we may get an AttributeError if we use a component profile | |
809 # as components don't have roster | |
810 contacts = [] | |
811 else: | |
812 raise e | |
813 | |
814 for contact in contacts: | |
805 jid_s, attr, groups = contact | 815 jid_s, attr, groups = contact |
806 _jid = JID(jid_s) | 816 _jid = JID(jid_s) |
807 try: | 817 try: |
808 names2jid[attr["name"].lower()] = jid_s | 818 names2jid[attr["name"].lower()] = jid_s |
809 except KeyError: | 819 except KeyError: |