class documentation

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_traverse__ 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_real_size Returns real size in ZODB.
Method getContentType Returns MIME-type (e.g. image/gif, text/xml).
Method getData Returns data.
Method getDataSizeStr Returns display string for file-size (kB). Deprecated: Use standard.getDataSizeStr(len) instead!
Method getDataURI Return the blob payload as a data URI.
Method getFilename Returns filename.
Method getHref Return the absolute URL for this blob.
Method getMediadbfile Returns mediadb-filename.
Method getMimeTypeIconSrc Returns the absolute-url of an icon representing the MIME-type of this MyBlob-object. Deprecated: Use zmscontext.getMimeTypeIconSrc(mt) instead!
Method getObjAttrs Return object attribute definitions for this blob.
Method on_setobjattr Persist blob data to MediaDB and detach acquisition wrappers when needed.
Class Variable __call____roles__ Undocumented
Class Variable __class_name__ Undocumented
Class Variable get_real_size__roles__ Undocumented
Class Variable get_size__roles__ Undocumented
Class Variable getContentType__roles__ Undocumented
Class Variable getData__roles__ Undocumented
Class Variable getDataSizeStr__roles__ Undocumented
Class Variable getDataURI__roles__ Undocumented
Class Variable getFilename__roles__ Undocumented
Class Variable getHref__roles__ Undocumented
Class Variable getMediadbfile__roles__ Undocumented
Class Variable getMimeTypeIconSrc__roles__ Undocumented
Class Variable getObjAttrs__roles__ Undocumented
Class Variable index_html Undocumented
Instance Variable aq_parent Undocumented
Instance Variable data Undocumented
Instance Variable filename Undocumented
Instance Variable mediadbfile Undocumented
Method _createCopy Create a copy of the blob bound to a new acquisition parent.
Method _if_modified_since_request_handler Undocumented
Method _range_request_handler Undocumented
def __bobo_traverse__(self, TraversalRequest, name): (source)

Return the blob itself during traversal.

def __call__(self, REQUEST=None, **kw): (source)

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 NoneThe HTTP request object containing headers and parameters
**kwAdditional keyword arguments
Returns
bytes or str or MyBlobBlob data as bytes or empty string, or self if not an HTTP request
def __str__(self): (source)

Undocumented

def equals(self, ob): (source)

Indicate whether another blob is equal to this one.

Parameters
ob:MyBlobBlob to compare against
Returns
boolTrue if both blobs have identical relevant attributes
def get_real_size(self): (source)

Returns real size in ZODB.

Returns
intUndocumented
def getContentType(self): (source)

Returns MIME-type (e.g. image/gif, text/xml).

Returns
stringMIME-type
def getData(self, parent=None): (source)

Returns data.

def getDataSizeStr(self): (source)

Returns display string for file-size (kB). Deprecated: Use standard.getDataSizeStr(len) instead!

Returns
stringfile-size in kB
def getDataURI(self): (source)

Return the blob payload as a data URI.

Returns
strData URI for the blob
def getFilename(self): (source)

Returns filename.

Returns
stringUndocumented
def getHref(self, REQUEST): (source)

Return the absolute URL for this blob.

Parameters
REQUEST:ZPublisher.HTTPRequestThe triggering request
Returns
strAbsolute URL including preview/version parameters when needed
def getMediadbfile(self): (source)

Returns mediadb-filename.

Returns
stringUndocumented
def getMimeTypeIconSrc(self): (source)

Returns the absolute-url of an icon representing the MIME-type of this MyBlob-object. Deprecated: Use zmscontext.getMimeTypeIconSrc(mt) instead!

Returns
stringicon url
def getObjAttrs(self, meta_type=None): (source)

Return object attribute definitions for this blob.

Parameters
meta_type:strOptional meta type filter
Returns
dictAttribute definition mapping
def on_setobjattr(self): (source)

Persist blob data to MediaDB and detach acquisition wrappers when needed.

__call____roles__ = (source)

Undocumented

__class_name__: str = (source)

Undocumented

get_real_size__roles__ = (source)

Undocumented

get_size__roles__ = (source)

Undocumented

getContentType__roles__ = (source)

Undocumented

getData__roles__ = (source)

Undocumented

getDataSizeStr__roles__ = (source)

Undocumented

getDataURI__roles__ = (source)

Undocumented

getFilename__roles__ = (source)

Undocumented

getHref__roles__ = (source)

Undocumented

getMediadbfile__roles__ = (source)

Undocumented

getMimeTypeIconSrc__roles__ = (source)

Undocumented

getObjAttrs__roles__ = (source)

Undocumented

index_html = (source)

Undocumented

aq_parent = (source)

Undocumented

data: str = (source)

Undocumented

filename = (source)

Undocumented

mediadbfile = (source)

Undocumented

def _createCopy(self, aq_parent, key, lang=None): (source)

Create a copy of the blob bound to a new acquisition parent.

Parameters
aq_parentNew acquisition parent
key:strAttribute key
lang:strOptional language identifier
Returns
MyBlobCopied blob instance
def _if_modified_since_request_handler(self, REQUEST, RESPONSE): (source)

Undocumented

def _range_request_handler(self, REQUEST, RESPONSE): (source)

Undocumented