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.
Functions
|
|
from_dom_node
make_dom_node
make_temporary_location
|
|
from_dom_node
|
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
|
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
|
make_temporary_location ()
Return a unique location for temporary attachment data.
|
Classes
|
|
|
|