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

Module qm.attachment

Code for handling arbitrary file attachments.

'Attachment' is a base class for classes that represent arbitrary
attachments.  Each 'Attachment' object has these four attributes:

  'mime_type' -- The MIME type of the attachment contents.  This
  information enables user interfaces to handle attachment data in a
  sensible fasion.

  'description' -- The user's description of the attachment contents.

  'file_name' -- A file name associated with the description.  This is
  usually the name of the file from which the attachment was originally
  uploaded or inserted.

  'location' -- A string containing the external location of the
  attachment data.  The semantics of this string are defined by
  implementations of 'AttachmentStore', which use it to locate the
  attachment's data.

A special 'TemporaryAttachmentStore', with a different interface, is
used to store attachment data temporarily, at most for the life of the
program.  The 'temporary_store' global instance should be used.

Classes
Attachment An arbitrary file attachment.
AttachmentStore Interface for classes which store attachment data.
FileAttachmentStore An attachment store based on the file system.
TemporaryAttachmentStore Temporary storage for attachment data.

Function Summary
  from_dom_node(node, store)
Construct an attachment object from a DOM element node.
  make_dom_node(attachment, document)
Create a DOM element node for this attachment.
  make_temporary_location()
Return a unique location for temporary attachment data.

Function Details

from_dom_node(node, store)

Construct an attachment object from a DOM element node.

'node' -- A DOM attachment element node.

'store' -- The associated attachment store.

returns -- An attachment instance. The type is determined by 'attachment_class'.

If the attachment object requires additional context information to interpret the location (if it's specified in the attachment element), the caller must provide it directly to the object.

make_dom_node(attachment, document)

Create a DOM element node for this attachment.

'document' -- A DOM document node in which to create the element.

returns -- A DOM element node.

make_temporary_location()

Return a unique location for temporary attachment data.

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