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

Module attachment
source code

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 [hide private]
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.

Functions [hide private]
  make_temporary_location()
Return a unique location for temporary attachment data.
  make_dom_node(attachment, document)
Create a DOM element node for this attachment.
  from_dom_node(node, store)
Construct an attachment object from a DOM element node.

Variables [hide private]
_temporary_location_prefix  

Function Details [hide private]

make_temporary_location()

source code 
Return a unique location for temporary attachment data.

make_dom_node(attachment, document)

source code 

Create a DOM element node for this attachment.

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

returns -- A DOM element node.

from_dom_node(node, store)

source code 

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.

Variables Details [hide private]

_temporary_location_prefix

Value:
'_temporary'