From e0085d7bfb4a3c706a9e3b5ce0d80d17880ee35e Mon Sep 17 00:00:00 2001 From: s3lph Date: Sun, 26 Sep 2021 18:49:41 +0200 Subject: [PATCH] Replace ValueErrors with an EasyWks-specific error class --- easywks/process.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/easywks/process.py b/easywks/process.py index 676bff7..4379ee3 100644 --- a/easywks/process.py +++ b/easywks/process.py @@ -10,7 +10,7 @@ from .types import SubmissionRequest, ConfirmationResponse, PublishResponse, Con from email.message import MIMEPart, Message from email.parser import BytesParser -from email.policy import default, SMTP +from email.policy import default from email.utils import getaddresses from pgpy import PGPMessage, PGPKey, PGPUID @@ -57,7 +57,7 @@ def _get_pgp_publickey(parts: List[MIMEPart]) -> PGPKey: except PGPError: pass if not pubkey: - raise EasyWksError('No PGP public key pubkey in message') + raise EasyWksError('No PGP public key in message') return pubkey @@ -134,11 +134,11 @@ def process_mail(mail: bytes = None): raise EasyWksError('Message has more than one recipients') _, rcpt_mail = rcpt[0] if rcpt_mail != submission_address: - raise EasyWksError(f'Message not addressed to submission address {submission_address} for domain {sender_domain}') + raise EasyWksError(f'Message not addressed to submission address {submission_address} ' + f'for domain {sender_domain}') leafs = _get_mime_leafs(msg) pgp: PGPMessage = _get_pgp_message(leafs) decrypted = pgp_decrypt(sender_domain, pgp) - rmsg = None if decrypted.is_signed: request: ConfirmationResponse = _parse_confirmation_response(decrypted, submission_address, sender_mail) try: