From fc9a56724aa1939aba58dfb8b61c1d4c87b9a534 Mon Sep 17 00:00:00 2001 From: Inso <insomniak.fr@gmail.com> Date: Fri, 13 Mar 2015 08:26:51 +0100 Subject: [PATCH] Fixed an error when a peron could not be found --- src/cutecoin/core/account.py | 2 +- src/cutecoin/core/app.py | 2 +- src/cutecoin/core/person.py | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/cutecoin/core/account.py b/src/cutecoin/core/account.py index 24772e50..9d14503a 100644 --- a/src/cutecoin/core/account.py +++ b/src/cutecoin/core/account.py @@ -285,7 +285,7 @@ class Account(QObject): :return: True if the account is a member of the target community ''' self_person = Person.lookup(self.pubkey, community) - return self_person.is_member() + return self_person.is_member(community) def send_selfcert(self, password, community): ''' diff --git a/src/cutecoin/core/app.py b/src/cutecoin/core/app.py index 591de4ca..f5e76c5d 100644 --- a/src/cutecoin/core/app.py +++ b/src/cutecoin/core/app.py @@ -168,7 +168,7 @@ class Application(QObject): with open(network_path, 'r') as json_data: data = json.load(json_data) if 'version' in data and data['version'] == __version__: - community.load_merge_network(data) + community.load_merge_network(data['network']) else: os.remove(network_path) diff --git a/src/cutecoin/core/person.py b/src/cutecoin/core/person.py index 153300c5..d65e0c7d 100644 --- a/src/cutecoin/core/person.py +++ b/src/cutecoin/core/person.py @@ -101,8 +101,13 @@ class Person(object): if cached and pubkey in Person._instances: return Person._instances[pubkey] else: - data = community.request(bma.wot.Lookup, req_args={'search': pubkey}, - cached=cached) + try: + data = community.request(bma.wot.Lookup, req_args={'search': pubkey}, + cached=cached) + except ValueError as e: + if '404' in str(e): + raise PersonNotFoundError(pubkey, community.name) + timestamp = 0 for result in data['results']: -- GitLab