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

Class FileAttachmentStore
source code

     object --+    
              |    
AttachmentStore --+
                  |
                 FileAttachmentStore
Known Subclasses:
TemporaryAttachmentStore

An attachment store based on the file system.

The locations are the names of files in the file system.

Instance Methods [hide private]
  __init__(self, root=None)
Construct a new 'FileAttachmentStore'
  GetData(self, location)
Return the data for an attachment.
  GetDataFile(self, location)
Return the path to a file containing the data for 'attachment'.
  GetSize(self, location)
Return the size of the data for an attachment.
  Store(self, attachment, location)
Add an attachment to the store.
  Remove(self, location)
Remove an attachment.

Inherited from AttachmentStore: HandleDownloadRequest

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Class Variables [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, root=None)
(Constructor)

source code 

Construct a new 'FileAttachmentStore'

'root' -- If not 'None', the root directory for the store. All locations are relative to this directory. If 'None', all locations are relative to the current directory.
Overrides: object.__init__

GetData(self, location)

source code 

Return the data for an attachment.

returns -- A string containing the attachment data.
Overrides: AttachmentStore.GetData
(inherited documentation)

GetDataFile(self, location)

source code 

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.
Overrides: AttachmentStore.GetDataFile
(inherited documentation)

GetSize(self, location)

source code 

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.
Overrides: AttachmentStore.GetSize
(inherited documentation)

Store(self, attachment, location)

source code 

Add an attachment to the store.

'attachment' -- The 'Attachment' to store.

'location' -- The location in which to store the 'attachment'.
Overrides: AttachmentStore.Store
(inherited documentation)

Remove(self, location)

source code 

Remove an attachment.

'location' -- The location whose data should be removed.