Skip to content
Snippets Groups Projects
Commit 6e7763bd authored by inso's avatar inso
Browse files

Fix lookup not called when looking for identies

parent 55abaa0b
No related branches found
No related tags found
No related merge requests found
...@@ -47,8 +47,7 @@ class IdentitiesRegistry: ...@@ -47,8 +47,7 @@ class IdentitiesRegistry:
@asyncio.coroutine @asyncio.coroutine
def future_find(self, pubkey, community): def future_find(self, pubkey, community):
def lookup(): def lookup():
identity = Identity.empty(pubkey) nonlocal identity
self._instances[pubkey] = identity
lookup_tries = 0 lookup_tries = 0
while lookup_tries < 3: while lookup_tries < 3:
try: try:
...@@ -67,7 +66,6 @@ class IdentitiesRegistry: ...@@ -67,7 +66,6 @@ class IdentitiesRegistry:
identity.blockchain_state = BlockchainState.BUFFERED identity.blockchain_state = BlockchainState.BUFFERED
identity.local_state = LocalState.PARTIAL identity.local_state = LocalState.PARTIAL
logging.debug("Lookup : found {0}".format(identity)) logging.debug("Lookup : found {0}".format(identity))
return identity
except ValueError as e: except ValueError as e:
lookup_tries += 1 lookup_tries += 1
except asyncio.TimeoutError: except asyncio.TimeoutError:
...@@ -75,8 +73,7 @@ class IdentitiesRegistry: ...@@ -75,8 +73,7 @@ class IdentitiesRegistry:
except ClientError: except ClientError:
lookup_tries += 1 lookup_tries += 1
except NoPeerAvailable: except NoPeerAvailable:
return identity pass
return identity
if pubkey in self._instances: if pubkey in self._instances:
identity = self._instances[pubkey] identity = self._instances[pubkey]
...@@ -92,8 +89,8 @@ class IdentitiesRegistry: ...@@ -92,8 +89,8 @@ class IdentitiesRegistry:
identity.blockchain_state = BlockchainState.VALIDATED identity.blockchain_state = BlockchainState.VALIDATED
return identity return identity
except ValueError as e: except ValueError as e:
if '404' in str(e): if '404' in str(e) or '400' in str(e):
return (yield from lookup()) yield from lookup()
else: else:
tries += 1 tries += 1
except asyncio.TimeoutError: except asyncio.TimeoutError:
......
...@@ -222,6 +222,7 @@ class IdentitiesTabWidget(QWidget, Ui_IdentitiesTab): ...@@ -222,6 +222,7 @@ class IdentitiesTabWidget(QWidget, Ui_IdentitiesTab):
if self.account and self.community: if self.account and self.community:
try: try:
self.busy.show() self.busy.show()
self.refresh_identities([])
self_identity = yield from self.account.identity(self.community) self_identity = yield from self.account.identity(self.community)
account_connections = [] account_connections = []
certs_of = yield from self_identity.unique_valid_certifiers_of(self.app.identities_registry, self.community) certs_of = yield from self_identity.unique_valid_certifiers_of(self.app.identities_registry, self.community)
...@@ -238,7 +239,6 @@ class IdentitiesTabWidget(QWidget, Ui_IdentitiesTab): ...@@ -238,7 +239,6 @@ class IdentitiesTabWidget(QWidget, Ui_IdentitiesTab):
except NoPeerAvailable: except NoPeerAvailable:
pass pass
finally: finally:
self.refresh_identities([])
self.busy.hide() self.busy.hide()
@once_at_a_time @once_at_a_time
......
...@@ -98,6 +98,8 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget): ...@@ -98,6 +98,8 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget):
self.date_to.setMaximumDateTime(tomorrow_datetime) self.date_to.setMaximumDateTime(tomorrow_datetime)
except NoPeerAvailable as e: except NoPeerAvailable as e:
logging.debug(str(e)) logging.debug(str(e))
except ValueError as e:
logging.debug(str(e))
def refresh(self): def refresh(self):
#TODO: Use resetmodel instead of destroy/create #TODO: Use resetmodel instead of destroy/create
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment