Mercurial > libervia-backend
changeset 1395:1ae9aa94c351
jp: fixed bad try/except hidding errors + fixed bad management of jids without node
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 30 Mar 2015 10:04:29 +0200 |
parents | e3624cb3765d |
children | 069ad98b360d |
files | frontends/src/jp/base.py |
diffstat | 1 files changed, 16 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/src/jp/base.py Wed Mar 25 16:10:17 2015 +0100 +++ b/frontends/src/jp/base.py Mon Mar 30 10:04:29 2015 +0200 @@ -184,10 +184,15 @@ nodes2jid = {} for contact in self.bridge.getContacts(self.profile): - _jid, attr, groups = contact - if attr.has_key("name"): - names2jid[attr["name"].lower()] = _jid - nodes2jid[JID(_jid).node.lower()] = _jid + jid_s, attr, groups = contact + _jid = JID(jid_s) + try: + names2jid[attr["name"].lower()] = jid_s + except KeyError: + pass + + if _jid.node: + nodes2jid[_jid.node.lower()] = jid_s def expand_jid(jid): _jid = jid.lower() @@ -356,16 +361,21 @@ def run(self): try: if self.args.profile: - self.host.connect_profile(self.connected) + connect_profile = self.host.connect_profile except AttributeError: # the command doesn't need to connect profile pass + else: + connect_profile(self.connected) + try: if self.args.progress: - self.host.watch_progress() + watch_progress = self.host.watch_progress except AttributeError: # the command doesn't use progress bar pass + else: + watch_progress() def connected(self): if not self.need_loop: