async def add(self, request): data = await request.post() if self.reject_next_post: self.reject_next_post = False return {'ucode': errors.UNHANDLED, 'message': "Rejected"}, 400 identity = Identity.from_signed_raw(data["identity"]) self.forge.pool.append(identity) return {}, 200
def import_identity_document(self): file_name = QFileDialog.getOpenFileName(self, self.tr("Open identity document"), "", self.tr("Duniter documents (*.txt)")) if file_name and file_name[0]: with open(file_name[0], 'r') as open_file: raw_text = open_file.read() try: identity_doc = Identity.from_signed_raw(raw_text) self.identity_document_imported.emit(identity_doc) except MalformedDocumentError as e: QMessageBox.warning(self, self.tr("Identity document"), self.tr("The imported file is not a correct identity document"), QMessageBox.Ok)
def import_identity_document(self): file_name = QFileDialog.getOpenFileName(self, self.tr("Open identity document"), "", self.tr("Duniter documents (*.txt)")) if file_name: with open(file_name[0], 'r') as open_file: raw_text = open_file.read() try: identity_doc = Identity.from_signed_raw(raw_text) self.identity_document_imported.emit(identity_doc) except MalformedDocumentError as e: QMessageBox.warning(self, self.tr("Identity document"), self.tr("The imported file is not a correct identity document"), QMessageBox.Ok)