Table of Contents

Class: AttachmentStore qm/attachment.py

Interface for classes which store attachment data.

An attachment store stores the raw data for an attachment. The store is not responsible for storing auxiliary information, including the attachment's description, file name, or MIME type.

Users of an AttachmentStore reference attachment data by a location, which is stored with the attachment.

Please note that the AttachmentStore interface provides methods for retrieving attachment data only; not for storing it. The interface for storing may be defined in any way by implementations.

Base Classes   
object
Methods   
GetData
GetDataFile
GetSize
HandleDownloadRequest
Store
  GetData 
GetData ( self,  location )

Return the data for an attachment.

returns
A string containing the attachment data.
Exceptions   
NotImplementedError
  GetDataFile 
GetDataFile ( self,  location )

Return the path to a file containing the data for attachment.

returns
A file system path.

The file is read-only, and may be a temporary file. The caller should not modify the file in any way.

Exceptions   
NotImplementedError
  GetSize 
GetSize ( self,  location )

Return the size of the data for an attachment.

returns
The length of the attachment data, in bytes.

This method may be overridden by derived classes.

  HandleDownloadRequest 
HandleDownloadRequest ( self,  request )

Handle a web request to download attachment data.

request
A WebRequest object. The location of the attachment data is stored in the location property, and the MIME type in the mime_type property.
returns
A pair (mime_type, data) where mime_type is the MIME type stored in the request and data is the contents of the attachment.
  Store 
Store (
        self,
        attachment,
        location,
        )

Add an attachment to the store.

attachment
The Attachment to store.
location
The location in which to store the attachment.
Exceptions   
NotImplementedError

Table of Contents

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