Package qm :: Module attachment :: Class Attachment
[show private | hide private]
[frames | no frames]

Class Attachment


An arbitrary file attachment.

Conceptually, an attachment is composed of these parts:
  1. A MIME type, as a string.
  2. A description, as a structured text string.
  3. 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.
  4. 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.
Method Summary
  __init__(self, mime_type, description, file_name, location, store)
Create a new attachment.
  __cmp__(self, other)
  __str__(self)
  GetData(self)
Get attachment data.
  GetDataFile(self)
Return the path to a file containing attachment data.
  GetDescription(self)
Return the attachment's description.
  GetFileName(self)
Return the attachment's file name.
  GetLocation(self)
Return the attachment's location in an attachment store.
  GetMimeType(self)
Return the attachment's MIME type.
  GetStore(self)
Return the store in which this attachment is located.
  Move(self, store, location)
Move the 'Attachment' to a new location.

Method Details

__init__(self, mime_type, description, file_name, location, store)
(Constructor)

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.

GetData(self)

Get attachment data.

returns -- The attachment data.

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(self)

Return the attachment's description.

GetFileName(self)

Return the attachment's file name.

GetLocation(self)

Return the attachment's location in an attachment store.

GetMimeType(self)

Return the attachment's MIME type.

GetStore(self)

Return the store in which this attachment is located.

returns -- The 'AttachmentStore' that contains this attachment.

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.

Generated by Epydoc 2.1 on Thu Sep 27 15:49:01 2007 http://epydoc.sf.net