class documentation
class MediaDb(OFS.SimpleItem.Item, Persistent, Acquisition.Implicit): (source)
Constructor: MediaDb(location, structure)
Persistent Zope object that stores uploaded binary assets in a flat or hierarchical filesystem.
The MediaDb provides methods to store and retrieve files, compute target paths, and manage the storage structure. The mediadb is designed to be attached to a ZMS content object as a child with a fixed id (acl_mediadb) and accessed via the getMediaDb() method. The mediadb location is configurable and supports expansion of $INSTANCE_HOME. The mediadb also provides management interface methods to serve files as HTTP responses and to reorganize the storage structure.
| Method | __init__ |
Initialize the instance state. |
| Method | get |
Stream the file identified by the request path as an HTTP response. |
| Method | get |
Return the size in bytes of the given mediadb file. |
| Method | get |
Return the resolved filesystem root path, expanding $INSTANCE_HOME. |
| Method | get |
Return the parent directory of the given filesystem path. |
| Method | get |
Return the requested filesystem path, defaulting to the mediadb root. |
| Method | get |
Return the directory nesting depth used for hierarchical storage (0 = flat). |
| Method | manage_change |
Apply submitted form changes to MediaDb location and redirect back to properties. |
| Method | manage |
Serve a mediadb file as a streaming HTTP response. |
| Method | manage |
Scan the mediadb and return a JSON report of OK/MISSING file statuses. |
| Method | read |
Return a directory listing for the given filesystem path. |
| Method | retrieve |
Return the raw bytes of the given mediadb file. |
| Method | retrieve |
Retrieve a mediadb file and return its content as a stream or bytes object. |
| Method | set |
Set the filesystem root path for the mediadb, stripping any trailing slash. |
| Method | store |
Store an uploaded file object into the mediadb and return its unique filename. |
| Method | target |
Compute the full filesystem path where a file should be stored. |
| Method | url |
Return the URL-encoded form of the given string. |
| Method | valid |
Return a list of (attr_path, filename) pairs for all mediadb-referenced files. |
| Class Variable | manage |
Undocumented |
| Class Variable | manage |
Undocumented |
| Class Variable | manage |
Undocumented |
| Class Variable | manage |
Undocumented |
| Class Variable | meta |
Undocumented |
| Class Variable | security |
Undocumented |
| Class Variable | zmi |
Undocumented |
| Instance Variable | id |
Undocumented |
| Instance Variable | location |
Undocumented |
| Instance Variable | structure |
Undocumented |