mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Cleanup: add reprs for Attachment, EmailAddress
This commit is contained in:
@@ -229,6 +229,10 @@ class EmailAddress:
|
||||
self.username = addr_spec
|
||||
self.domain = ''
|
||||
|
||||
def __repr__(self):
|
||||
return "EmailAddress({display_name!r}, {addr_spec!r})".format(
|
||||
display_name=self.display_name, addr_spec=self.addr_spec)
|
||||
|
||||
@property
|
||||
def address(self):
|
||||
if self._address is None:
|
||||
@@ -309,6 +313,18 @@ class Attachment:
|
||||
if self.content_type is None:
|
||||
self.content_type = self.mimetype
|
||||
|
||||
def __repr__(self):
|
||||
details = [
|
||||
self.mimetype,
|
||||
"len={length}".format(length=len(self.content)),
|
||||
]
|
||||
if self.name:
|
||||
details.append("name={name!r}".format(name=self.name))
|
||||
if self.inline:
|
||||
details.insert(0, "inline")
|
||||
details.append("content_id={content_id!r}".format(content_id=self.content_id))
|
||||
return "Attachment<{details}>".format(details=", ".join(details))
|
||||
|
||||
@property
|
||||
def b64content(self):
|
||||
"""Content encoded as a base64 ascii string"""
|
||||
|
||||
Reference in New Issue
Block a user