Package Products :: Package ZenModel :: Module ZenPackPersistence :: Class ZenPackPersistence |
[hide private]
[frames] | no frames]

# Class ZenPackPersistence

source code

    object --+
             |
            ZenPackPersistence

This is a mix-in class that should be used whenever a ZenPack-supplied class is going to be stored persistently in the zodb. It provides for a catalog to associate objects in zodb with the ZenPacks that provide those objects' classes.

The motivation for this is that we usually need to delete all instances of zenpack-supplied classes when that zenpack is deleted. This is because the class for those objects no longer exists and they are just sad, broken, unloved objects in the zodb at that point. This is undesirable.

IMPORTANT: This should be the first class listed in any subclasses's list of parents. Otherwise the manage_* methods of the other classes will likely be called and these skipped.

Instance Methods | [hide private]
getZenPackName(self) | source code
getZenPack(self, context) Return the ZenPack instance that provides this object. | source code
path(self, *parts) Return the path to the installed ZenPack directory or a subdirectory. | source code
index_object(self) A common method to allow Findables to index themselves. | source code
unindex_object(self) A common method to allow Findables to unindex themselves. | source code

Method Details | [hide private]

### path(self, *parts) | source code
Return the path to the installed ZenPack directory or a subdirectory. Example: zenpack.path('libexec') would return something like $ZENHOME/ZenPacks/ZenPacks.Me.MyZenPack/ZenPacks/Me/MyZenPack/libexec