Commit 485bd3e8 authored by matograine's avatar matograine

* Add an error message if the transfer returns an error

* move empty wallets and signed files to backup folder, in case the transfer indeed took place.
parent 645df246
......@@ -46,11 +46,18 @@ class Creating:
#self.transfer = False
if self.key and self.pages <= MAX_PAGES:
Generator(self.pdf_output, self.wallets, self.amount, self.date, self.pages).generate()
transfer = Transfer(self.amount, self.pages, self.wallets, self.date)
self.save_json()
if self.amount > 0:
transfer.transfer(self.key)
try:
self.save_json()
transfer = Transfer(self.amount, self.pages, self.wallets, self.date)
if self.amount > 0:
transfer.transfer(self.key)
except:
self.transfer_error()
def transfer_error(self):
os.rename(self.pdf_output, self.backup_folder + self.output + PDF_EXTENSION)
os.rename(self.signed_output, self.backup_folder + self.output + SIGNED_EXTENSION)
print ("\nERREUR : Quelque chose s'est mal passé durant le transfert.\nLes fichiers {0}{1}/{2} ont été déplacés dans le dossier {3}.\nVérifiez si le transfert a bien eu lieu.\nVérifiez que le noeud Duniter est disponible.\n".format(self.output, PDF_EXTENSION, SIGNED_EXTENSION, self.backup_folder))
def save_json(self): #, key):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment