From 0f14c3e74e5d06b510bf48e6b3d998164b9af2fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Casaj=C3=BAs?= Date: Thu, 21 Apr 2022 15:25:06 +0200 Subject: [PATCH] Move some comments as docstrings --- app/email_utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/email_utils.py b/app/email_utils.py index cba5dc7a..a5e9ea37 100644 --- a/app/email_utils.py +++ b/app/email_utils.py @@ -1476,6 +1476,9 @@ def save_envelope_for_debugging(envelope: Envelope, file_name_prefix=None) -> st def generate_verp_email( verp_type: VerpType, object_id: int, sender_domain: Optional[str] = None ) -> str: + """Generates an email address with the verp type, object_id and domain encoded in the address + and signed with hmac to prevent tampering + """ # Encoded as a list to minimize size of email address # Time is in minutes granularity and start counting on 2022-01-01 to reduce bytes to represent time data = [ @@ -1523,9 +1526,10 @@ def deprecated_get_verp_info_from_email(email: str) -> Optional[Tuple[VerpType, return VerpType(data[0]), data[1] -# This method processes the email address, checks if it's a signed verp email generated by us to receive bounces -# and extracts the type of verp email and associated email log id/transactional email id stored as object_id def new_get_verp_info_from_email(email: str) -> Optional[Tuple[VerpType, int]]: + """This method processes the email address, checks if it's a signed verp email generated by us to receive bounces + and extracts the type of verp email and associated email log id/transactional email id stored as object_id + """ idx = email.find("@") if idx == -1: return None