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

Fixing some bugs

parent 5ecbc3dd
No related branches found
No related tags found
No related merge requests found
...@@ -44,4 +44,4 @@ class Sources(Tx): ...@@ -44,4 +44,4 @@ class Sources(Tx):
def __get__(self, **kwargs): def __get__(self, **kwargs):
assert self.pubkey is not None assert self.pubkey is not None
return self.requests_get('/sources/%s' % self.pubkey, **kwargs).json() return self.requests_get('/sources/%d' % self.pubkey, **kwargs).json()
...@@ -265,7 +265,7 @@ class InputSource(): ...@@ -265,7 +265,7 @@ class InputSource():
@classmethod @classmethod
def from_bma(cls, bma_data): def from_bma(cls, bma_data):
index = None index = None
source = bma_data['type'] source = bma_data['source']
number = bma_data['number'] number = bma_data['number']
txhash = bma_data['fingerprint'] txhash = bma_data['fingerprint']
amount = bma_data['amount'] amount = bma_data['amount']
......
...@@ -35,7 +35,6 @@ class StepPageInit(Step): ...@@ -35,7 +35,6 @@ class StepPageInit(Step):
return False return False
def process_next(self): def process_next(self):
logging.debug("Init NEXT")
if self.config_dialog.account is None: if self.config_dialog.account is None:
name = self.config_dialog.edit_account_name.text() name = self.config_dialog.edit_account_name.text()
self.config_dialog.account = self.config_dialog.core.create_account(name) self.config_dialog.account = self.config_dialog.core.create_account(name)
...@@ -44,7 +43,6 @@ class StepPageInit(Step): ...@@ -44,7 +43,6 @@ class StepPageInit(Step):
self.config_dialog.account.name = name self.config_dialog.account.name = name
def display_page(self): def display_page(self):
logging.debug("Init DISPLAY")
if self.config_dialog.account is not None: if self.config_dialog.account is not None:
self.config_dialog.edit_account_name.setText(self.config_dialog.account.name) self.config_dialog.edit_account_name.setText(self.config_dialog.account.name)
model = CommunitiesListModel(self.config_dialog.account) model = CommunitiesListModel(self.config_dialog.account)
...@@ -75,7 +73,6 @@ class StepPageKey(Step): ...@@ -75,7 +73,6 @@ class StepPageKey(Step):
return True return True
def process_next(self): def process_next(self):
logging.debug("Key NEXT")
salt = self.config_dialog.edit_email.text() salt = self.config_dialog.edit_email.text()
password = self.config_dialog.edit_password.text() password = self.config_dialog.edit_password.text()
self.config_dialog.account.salt = salt self.config_dialog.account.salt = salt
...@@ -84,7 +81,6 @@ class StepPageKey(Step): ...@@ -84,7 +81,6 @@ class StepPageKey(Step):
self.config_dialog.list_communities.setModel(model) self.config_dialog.list_communities.setModel(model)
def display_page(self): def display_page(self):
logging.debug("Key DISPLAY")
self.config_dialog.button_previous.setEnabled(False) self.config_dialog.button_previous.setEnabled(False)
self.config_dialog.button_next.setEnabled(False) self.config_dialog.button_next.setEnabled(False)
......
...@@ -11,6 +11,8 @@ from PyQt5.QtWidgets import QDialog, QMenu, QMessageBox, QWidget, QAction ...@@ -11,6 +11,8 @@ from PyQt5.QtWidgets import QDialog, QMenu, QMessageBox, QWidget, QAction
from PyQt5.QtCore import QSignalMapper from PyQt5.QtCore import QSignalMapper
from cutecoin.models.node.treeModel import NodesTreeModel from cutecoin.models.node.treeModel import NodesTreeModel
from cutecoin.models.node import Node from cutecoin.models.node import Node
from cutecoin.models.person import Person
from cutecoin.tools.exceptions import PersonNotFoundError
from cutecoin.tools.exceptions import Error from cutecoin.tools.exceptions import Error
...@@ -157,11 +159,21 @@ class ProcessConfigureCommunity(QDialog, Ui_CommunityConfigurationDialog): ...@@ -157,11 +159,21 @@ class ProcessConfigureCommunity(QDialog, Ui_CommunityConfigurationDialog):
menu.exec_(self.mapToGlobal(point)) menu.exec_(self.mapToGlobal(point))
def accept(self): def accept(self):
try:
Person.lookup(self.account.pubkey, self.community)
except PersonNotFoundError as e:
reply = QMessageBox.question(self, "Pubkey not found",
"The public key of your account wasn't found in the community. :\n \
{0}\n \
Would you like to publish the key ?".format(self.account.pubkey))
if reply == QMessageBox.Yes:
try: try:
self.account.send_pubkey(self.community) self.account.send_pubkey(self.community)
except Error as e: except Error as e:
QMessageBox.critical(self, "Pubkey publishing error", QMessageBox.critical(self, "Pubkey publishing error",
e.message) e.message)
else:
return
self.accepted.emit() self.accepted.emit()
self.close() self.close()
...@@ -46,7 +46,7 @@ class Node(object): ...@@ -46,7 +46,7 @@ class Node(object):
def __eq__(self, other): def __eq__(self, other):
pubkey = bma.network.Peering(server=self.server, pubkey = bma.network.Peering(server=self.server,
port=self.port).get()['puubkey'] port=self.port).get()['pubkey']
other_pubkey = bma.network.Peering(server=other.server, other_pubkey = bma.network.Peering(server=other.server,
port=other.port).get()['pubkey'] port=other.port).get()['pubkey']
return (pubkey == other_pubkey) return (pubkey == other_pubkey)
......
...@@ -37,6 +37,10 @@ class Person(object): ...@@ -37,6 +37,10 @@ class Person(object):
name = uids[0]["uid"] name = uids[0]["uid"]
else: else:
raise PersonNotFoundError(pubkey, community.name()) raise PersonNotFoundError(pubkey, community.name())
return None
else:
raise PersonNotFoundError(pubkey, community.name())
return None
return cls(name, pubkey) return cls(name, pubkey)
@classmethod @classmethod
......
...@@ -24,7 +24,7 @@ class NotMemberOfCommunityError(Error): ...@@ -24,7 +24,7 @@ class NotMemberOfCommunityError(Error):
''' '''
Constructor Constructor
''' '''
super(NotMemberOfCommunityError, self) \ super() \
.__init__(account + " is not a member of " + community) .__init__(account + " is not a member of " + community)
...@@ -39,9 +39,7 @@ class PersonNotFoundError(Error): ...@@ -39,9 +39,7 @@ class PersonNotFoundError(Error):
''' '''
Constructor Constructor
''' '''
super( super() .__init__(
PersonNotFoundError,
self) .__init(
"Person looked by " + "Person looked by " +
value + value +
" in " + " in " +
...@@ -59,7 +57,7 @@ class AlgorithmNotImplemented(Error): ...@@ -59,7 +57,7 @@ class AlgorithmNotImplemented(Error):
''' '''
Constructor Constructor
''' '''
super(AlgorithmNotImplemented, self) \ super() \
.__init__("Algorithm " + algo_name + " not implemented.") .__init__("Algorithm " + algo_name + " not implemented.")
...@@ -74,9 +72,7 @@ class KeyAlreadyUsed(Error): ...@@ -74,9 +72,7 @@ class KeyAlreadyUsed(Error):
''' '''
Constructor Constructor
''' '''
super( super() .__init__(
KeyAlreadyUsed,
self) .__init__(
"Cannot add account " + "Cannot add account " +
new_account.name + new_account.name +
" : the pgpKey " + " : the pgpKey " +
...@@ -96,9 +92,7 @@ class NameAlreadyExists(Error): ...@@ -96,9 +92,7 @@ class NameAlreadyExists(Error):
''' '''
Constructor Constructor
''' '''
super( super() .__init__(
KeyAlreadyUsed,
self) .__init__(
"Cannot add account " + "Cannot add account " +
account.name + account.name +
" the name already exists") " the name already exists")
...@@ -115,7 +109,5 @@ class BadAccountFile(Error): ...@@ -115,7 +109,5 @@ class BadAccountFile(Error):
''' '''
Constructor Constructor
''' '''
super( super() .__init__(
BadAccountFile,
self) .__init__(
"File " + path + " is not an account file") "File " + path + " is not an account file")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment