An arbitrary file attachment.
Conceptually, an attachment is composed of these parts:
A MIME type, as a string.
A description, as a structured text string.
A file name, corresponding to the original name of the file from
which the attachment was uploaded, or the name of the file to
use when the attachment is presented to the user in a file
system.
A block of arbitrary data.
For efficiency reasons, the attachment data is not stored in the
attachment. Instead, a location is stored, which is a key into
the associated AttachmentStore object.
Methods
|
|
|
|
GetData
|
GetData ( self )
Get attachment data.
- returns
- The attachment data.
|
|
GetDataFile
|
GetDataFile ( self )
Return the path to a file containing attachment data.
- returns
- A file system path. The file should be considered
read-only, and should not be modified in any way.
|
|
GetDescription
|
GetDescription ( self )
Return the attachment's description.
|
|
GetFileName
|
GetFileName ( self )
Return the attachment's file name.
|
|
GetLocation
|
GetLocation ( self )
Return the attachment's location in an attachment store.
|
|
GetMimeType
|
GetMimeType ( self )
Return the attachment's MIME type.
|
|
GetStore
|
GetStore ( self )
Return the store in which this attachment is located.
- returns
- The
AttachmentStore that contains this attachment.
|
|
Move
|
Move (
self,
store,
location,
)
Move the Attachment to a new location.
-
store
- The
AttachmentStore that will contain the
attachment.
-
location
- The location of the attachment within its current
store.
|
|
__cmp__
|
__cmp__ ( self, other )
|
|
__init__
|
__init__ (
self,
mime_type,
description,
file_name,
location,
store,
)
Create a new attachment.
-
mime_type
- The MIME type. If
None or an empty string, the
function attempts to guess the MIME type from other information.
-
description
- A description of the attachment contents.
-
file_name
- The user-visible file name to associate the
attachment.
-
location
- The location in an attachment store at which to
find the attachment data.
-
store
- The attachment store in which the data is stored.
|
|
__str__
|
__str__ ( self )
|
|