Move some comments as docstrings

This commit is contained in:
Adrià Casajús 2022-04-21 15:25:06 +02:00
parent 112b2c77c3
commit 0f14c3e74e
No known key found for this signature in database
GPG Key ID: F0033226A5AFC9B9
1 changed files with 6 additions and 2 deletions

View File

@ -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