Skip to content
Snippets Groups Projects
Commit dafbf527 authored by Vincent Texier's avatar Vincent Texier
Browse files

[fix] fix initialize identity if identity with no memberships

Enhance connection dialogs controller.py
parent 1554f897
No related branches found
No related tags found
1 merge request!7750.50.0
...@@ -165,6 +165,7 @@ class IdentitiesProcessor: ...@@ -165,6 +165,7 @@ class IdentitiesProcessor:
log_stream("Requesting membership data") log_stream("Requesting membership data")
progress(1 / 3) progress(1 / 3)
try: try:
# Return a 1002 - MEMBER_NOT_FOUND if identity has no memberships or not written in blockchain
memberships_data = await self._bma_connector.get( memberships_data = await self._bma_connector.get(
identity.currency, identity.currency,
bma.blockchain.memberships, bma.blockchain.memberships,
...@@ -215,7 +216,7 @@ class IdentitiesProcessor: ...@@ -215,7 +216,7 @@ class IdentitiesProcessor:
identity.outdistanced = identity_data["outdistanced"] identity.outdistanced = identity_data["outdistanced"]
self.insert_or_update_identity(identity) self.insert_or_update_identity(identity)
except errors.DuniterError as e: except errors.DuniterError as e:
if e.ucode == errors.NO_MEMBER_MATCHING_PUB_OR_UID: if e.ucode == errors.NO_MEMBER_MATCHING_PUB_OR_UID or e.message == 'MEMBER_NOT_FOUND':
identity.written = False identity.written = False
self.insert_or_update_identity(identity) self.insert_or_update_identity(identity)
else: else:
......
...@@ -274,7 +274,7 @@ class ConnectionConfigController(QObject): ...@@ -274,7 +274,7 @@ class ConnectionConfigController(QObject):
self.view.edit_uid.show() self.view.edit_uid.show()
asyncio.ensure_future(self.process()) asyncio.ensure_future(self.process())
return return
self.accept() await self.accept()
def check_key(self): def check_key(self):
if self.mode == ConnectionConfigController.PUBKEY: if self.mode == ConnectionConfigController.PUBKEY:
...@@ -389,8 +389,10 @@ Yours : {0}, the network : {1}""".format( ...@@ -389,8 +389,10 @@ Yours : {0}, the network : {1}""".format(
except DuniterError as e: except DuniterError as e:
self.view.display_info(e.message) self.view.display_info(e.message)
self.step_key.set_result(None)
except NoPeerAvailable as e: except NoPeerAvailable as e:
self.view.display_info(str(e)) self.view.display_info(str(e))
self.step_key.set_result(None)
else: else:
self.view.display_info( self.view.display_info(
self.tr("A connection already exists using this key.") self.tr("A connection already exists using this key.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment