From 5a7c9fbbfee531bc436cbe713150452e474d3d55 Mon Sep 17 00:00:00 2001 From: Inso <insomniak.fr@gmail.com> Date: Sat, 5 Sep 2015 18:59:30 +0200 Subject: [PATCH] Integrating fixes from mocks branch --- src/cutecoin/core/account.py | 2 +- src/cutecoin/core/net/api/bma/__init__.py | 9 ++++++++- src/cutecoin/gui/process_cfg_community.py | 12 +++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/cutecoin/core/account.py b/src/cutecoin/core/account.py index b26ad98b..3491a551 100644 --- a/src/cutecoin/core/account.py +++ b/src/cutecoin/core/account.py @@ -298,7 +298,7 @@ class Account(QObject): key = SigningKey(self.salt, password) selfcert.sign([key]) logging.debug("Key publish : {0}".format(selfcert.signed_raw())) - replies = community.broadcast(qtbma.wot.Add, {}, {'pubkey': self.pubkey, + replies = community.bma_access.broadcast(qtbma.wot.Add, {}, {'pubkey': self.pubkey, 'self_': selfcert.signed_raw(), 'other': []}) for r in replies: diff --git a/src/cutecoin/core/net/api/bma/__init__.py b/src/cutecoin/core/net/api/bma/__init__.py index 00af271a..699a8cb7 100644 --- a/src/cutecoin/core/net/api/bma/__init__.py +++ b/src/cutecoin/core/net/api/bma/__init__.py @@ -126,7 +126,14 @@ class API(object): logging.debug("POST : {0}".format(kwargs)) post_data = QUrlQuery() for k, v in kwargs.items(): - post_data.addQueryItem(k.replace("+", "%2b"), v.replace("+", "%2b")) + if type(k) is str: + k = k.replace("+", "%2b") + if type(v) is str: + v = v.replace("+", "%2b") + else: + v = json.dumps(v) + v = v.replace("+", "%2b") + post_data.addQueryItem(k, v) url = QUrl(self.reverse_url(path)) url.setQuery(post_data) diff --git a/src/cutecoin/gui/process_cfg_community.py b/src/cutecoin/gui/process_cfg_community.py index 6ec9c491..ad439b71 100644 --- a/src/cutecoin/gui/process_cfg_community.py +++ b/src/cutecoin/gui/process_cfg_community.py @@ -210,13 +210,23 @@ class ProcessConfigureCommunity(QDialog, Ui_CommunityConfigurationDialog): QApplication.restoreOverrideCursor() self.add_community_and_close() + @pyqtSlot(int, str) + def handle_broadcast(self, error_code, text): + if self.app.preferences['notifications']: + toast.display(self.tr("UID broadcast"), self.tr("Identity broadcasted to the network")) + else: + QMessageBox.information(self, self.tr("UID broadcast"), self.tr("Identity broadcasted to the network")) + self.account.certification_broadcasted.disconnect() + self.account.broadcast_error.disconnect(self.handle_error) + QApplication.restoreOverrideCursor() + @pyqtSlot(int, str) def handle_error(self, error_code, text): if self.app.preferences['notifications']: toast.display(self.tr("Error"), self.tr("{0} : {1}".format(error_code, text))) else: QMessageBox.critical(self, self.tr("Error"), self.tr("{0} : {1}".format(error_code, text))) - self.account.certification_broadcasted.disconnect() + self.account.selfcert_broadcasted.disconnect() self.account.broadcast_error.disconnect(self.handle_error) QApplication.restoreOverrideCursor() -- GitLab