google.appengine.api.mail.Attachment

Attachment object.

Inherits From: expected_type

An Attachment object is largely interchangeable with a (filename, payload) tuple.

Note:

The behavior is a bit asymmetric with respect to unpacking and equality comparison. An Attachment object without a content ID will be equivalent to a (filename, payload) tuple. An Attachment with a content ID will unpack to a (filename, payload) tuple, but will compare unequally to that tuple.

Thus, the following comparison will succeed:

attachment = mail.Attachment('foo.jpg', 'data')
filename, payload = attachment
attachment == filename, payload

...while the following will fail:

attachment = mail.Attachment('foo.jpg', 'data', content_id='<foo>')
filename, payload = attachment
attachment == filename, payload

The following comparison will pass:

attachment = mail.Attachment('foo.jpg', 'data', content_id='') attachment == (attachment.filename, attachment.payload, attachment.content_id)

filename The name of the attachment.
payload The attachment data.
content_id Optional; the content ID for this attachment.

filename The name of the attachment.
payload The attachment data.
content_id Optional; the content ID for this attachment. Keyword only.

Methods

__contains__

View source

__eq__

View source

Return self==value.

__getitem__

View source

__iter__

View source

__len__

View source

__ne__

View source

Return self!=value.