class documentation

A mix-in class for making objects bindable.

PyZim distinguishes between two types of objects: bound and unbound ones. Both use the same classes, but only bound ones hold a reference to the zim archive. Consequently, only bound objects can access data in the ZIM file.

Take an entry for example: The entry it self only contains the index of the cluster that contains the content as well as the index of the blob within the cluster. Unbound entries have no way to access the ZIM archive, thus the object can not provide a way to directly access the content. A bound entry, however, can provide an interface for accessing the content.

So why have unbound objects anyway? To answer this question: it's way easier to work with unbound objects when they are not yet part of the ZIM file (e.g. when writing). It also makes moving entries between ZIM files easier.

Method __init__ The default constructor. Don't forget to call this in subclasses.
Method bind Bind this object to a ZIM file.
Method unbind Unbind this object. Can be called multiple times.
Property bound Whether this object is bound to a ZIM file or not.
Property zim The bound ZIM archive, if any is bound. Otherwise None.
Instance Variable _zim the bound ZIM archive or None
def __init__(self, zim=None):

The default constructor. Don't forget to call this in subclasses.

Parameters
zim:pyzim.archive.Zimif specified, bind this ZIM immediately.
def bind(self, zim):

Bind this object to a ZIM file.

This can be called multiple times, provided that "zim" is always the same pyzim.archive.Zim object.

Parameters
zim:pyzim.archive.ZimZIM archive to bind to
Raises
pyzim.exceptions.AlreadyBoundwhen already bound to a zim archive
def unbind(self):

Unbind this object. Can be called multiple times.

bound: bool =

Whether this object is bound to a ZIM file or not.

The bound ZIM archive, if any is bound. Otherwise None.

the bound ZIM archive or None