coherence.backends.models.containers (module)¶
Backend models for Container¶
Backend container to be used as a container for backend items, used by backend
store BackendBaseStore
.
The BackendContainer inherits from Container
and
will initialize a Container
stored into
variable BackendContainer.item
. This is the base class for our
containers.
We also provide some more containers:
BackendMusicAlbum
: Container which will contain audio items from an album
BackendBasePlaylist
: Container which will contain items to be played
Note
To write this module, some of the the old backends has been taken as a reference:
Warning
Be aware that we use super to initialize all the classes of this module in order to have a better MRO class resolution…so…take it into account if you inherit from one of this classes.
New in version 0.8.3.
-
class
BackendContainer
(item_id, parent_id, name, **kwargs)[source]¶ Bases:
coherence.backend.Container
The BackendContainer will hold the reference to all your instances of BackendItem/s. This class could be used as a container for a simple backend. It is almost the same as a
Container
but with some slight differences that will make easier to create an inherited class form BackendContainer:The arguments to initialize the BackendContainer are
When we initialize the BackendContainer we also create an attribute item whim will be of
Container
which will allow us to perform most of the operations we need to operate with your BackendItem/s
-
logCategory
= 'BackendContainer'¶
-
item_cls
¶
-
item
= None¶ Define the initialized
item_cls
. It will be set when the classBackendContainer
is initialized based on the attributeitem_cls
-
class
BackendMusicAlbum
(item_id, parent_id, name, **kwargs)[source]¶ Bases:
coherence.backends.models.containers.BackendContainer
Definition for a music album. This is an inherited class from
BackendContainer
but we use a different item classMusicAlbum
to create our item-
logCategory
= 'BackendMusicAlbum'¶
-
item_cls
¶
-
-
class
BackendBasePlaylist
(item_id, parent_id, name, **kwargs)[source]¶ Bases:
coherence.backends.models.containers.BackendContainer
Definition for a playlist. This is an inherited class from
BackendContainer
but we use a different item classPlaylistContainer
to create our item-
logCategory
= 'BackendBasePlaylist'¶
-
item_cls
¶
-