class MyBlob(object): (source)
Known subclasses: zms._blobfields.MyFile, zms._blobfields.MyImage
Base class for binary large objects (blobs) stored in ZMS.
MyBlob provides the core functionality for managing files and images in ZMS, including HTTP request handling, caching, range requests, and MediaDB integration.
Features:
- HTTP request/response handling via __call__() method
- Visibility and access permission checks
- HTTP caching headers (Last-Modified, If-Modified-Since, ETags)
- HTTP Range requests for partial content delivery
- Content-Type and Content-Disposition header management
- MediaDB file storage and retrieval with ZODB fallback
- Data serialization to XML format
- File copying and cloning support
This is an abstract base class; use MyImage for images or MyFile for files.
| Method | __bobo |
Return the blob itself during traversal. |
| Method | __call__ |
Handle HTTP request for blob object (file/image). |
| Method | __str__ |
Undocumented |
| Method | equals |
Indicate whether another blob is equal to this one. |
| Method | get |
Returns real size in ZODB. |
| Method | get |
Returns MIME-type (e.g. image/gif, text/xml). |
| Method | get |
Returns data. |
| Method | get |
Returns display string for file-size (kB). Deprecated: Use standard.getDataSizeStr(len) instead! |
| Method | get |
Return the blob payload as a data URI. |
| Method | get |
Returns filename. |
| Method | get |
Return the absolute URL for this blob. |
| Method | get |
Returns mediadb-filename. |
| Method | get |
Returns the absolute-url of an icon representing the MIME-type of this MyBlob-object. Deprecated: Use zmscontext.getMimeTypeIconSrc(mt) instead! |
| Method | get |
Return object attribute definitions for this blob. |
| Method | on |
Persist blob data to MediaDB and detach acquisition wrappers when needed. |
| Class Variable | __call |
Undocumented |
| Class Variable | __class |
Undocumented |
| Class Variable | get |
Undocumented |
| Class Variable | get |
Undocumented |
| Class Variable | get |
Undocumented |
| Class Variable | get |
Undocumented |
| Class Variable | get |
Undocumented |
| Class Variable | get |
Undocumented |
| Class Variable | get |
Undocumented |
| Class Variable | get |
Undocumented |
| Class Variable | get |
Undocumented |
| Class Variable | get |
Undocumented |
| Class Variable | get |
Undocumented |
| Class Variable | index |
Undocumented |
| Instance Variable | aq |
Undocumented |
| Instance Variable | data |
Undocumented |
| Instance Variable | filename |
Undocumented |
| Instance Variable | mediadbfile |
Undocumented |
| Method | _create |
Create a copy of the blob bound to a new acquisition parent. |
| Method | _if |
Undocumented |
| Method | _range |
Undocumented |
Handle HTTP request for blob object (file/image).
This method processes requests for blob objects, handling:
- Visibility and access permission checks
- HTTP caching headers (Last-Modified, If-Modified-Since, ETags)
- Range requests for partial content delivery
- Content-Type and Content-Disposition headers
- MediaDB file retrieval or ZODB data fallback
| Parameters | |
| REQUEST:ZPublisher.HTTPRequest or None | The HTTP request object containing headers and parameters |
| **kw | Additional keyword arguments |
| Returns | |
| bytes or str or MyBlob | Blob data as bytes or empty string, or self if not an HTTP request |
Indicate whether another blob is equal to this one.
| Parameters | |
ob:MyBlob | Blob to compare against |
| Returns | |
| bool | True if both blobs have identical relevant attributes |
Returns display string for file-size (kB). Deprecated: Use standard.getDataSizeStr(len) instead!
| Returns | |
| string | file-size in kB |
Return the absolute URL for this blob.
| Parameters | |
| REQUEST:ZPublisher.HTTPRequest | The triggering request |
| Returns | |
| str | Absolute URL including preview/version parameters when needed |
Returns the absolute-url of an icon representing the MIME-type of this MyBlob-object. Deprecated: Use zmscontext.getMimeTypeIconSrc(mt) instead!
| Returns | |
| string | icon url |
Return object attribute definitions for this blob.
| Parameters | |
| meta | Optional meta type filter |
| Returns | |
| dict | Attribute definition mapping |
Create a copy of the blob bound to a new acquisition parent.
| Parameters | |
| aq | New acquisition parent |
| key:str | Attribute key |
| lang:str | Optional language identifier |
| Returns | |
MyBlob | Copied blob instance |