Table of Contents

Class: Attachment qm/attachment.py

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.

Methods   
GetData
GetDataFile
GetDescription
GetFileName
GetLocation
GetMimeType
GetStore
Move
__cmp__
__init__
__str__
  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 )


Table of Contents

This document was automatically generated on Mon Jan 3 09:42:29 2005 by HappyDoc version 2.1