meta – Kofa Components Grokkers Module

Grokkers for Kofa components.

Stuff in here is mainly taken from grok.meta, with some modifications to provide a possibility to update catalogs in a running site. This is to solve the very common problem of already running sites for which the software changes and adds catalogs. These catalogs will not be automatically added in a running site.

With the following Grokker and the upgrade helper class we can fire IObjectUpgradedEvents for any existing site and all catalogs registered will be really created.

Please note that yet these catalogs are not filled automatically! That means the catalogs will exist but are empty in the beginning.

We might solve this second problem by firing extra events like some ICatalogUpdatedEvent (which still do not exist) or similar.

class waeup.kofa.meta.IndexesGrokker[source]

Bases: martian.components.InstanceGrokker

Grokker for Grok index bundles.

__doc__ = 'Grokker for Grok index bundles.'
__module__ = 'waeup.kofa.meta'
grok(name, factory, module_info, config, **kw)[source]
class waeup.kofa.meta.KofaIndexesUpgradeSubscriber(catalog_name, indexes, context, module_info)[source]

Bases: grok.meta.IndexesSetupSubscriber

Helper that sets up indexes when their Grok site is upgraded.

Each grok.Indexes class serves as an assertion that, whenever an instance of its grok.site() is upgraded, the given list of indexes should be generated if not already created as well. But a long period of time could elapse between when the application starts (and its indexes are grokked), and the moment, maybe days or weeks later, when a new instance of that grok.Site is created. Hence this IndexesSetupSubscriber: it can be instantiated at grokking time with the index information, and then registered with the Component Architecture as an event that should be fired later, whenever the right kind of grok.Site is instantiated. At that point its __call__ method is kicked off and it makes sure the index catalogs get created properly.

__call__(site, event)[source]
__doc__ = 'Helper that sets up indexes when their Grok site is upgraded.\n\n Each `grok.Indexes` class serves as an assertion that, whenever an\n instance of its `grok.site()` is upgraded, the given list of\n indexes should be generated if not already created as well. But a\n long period of time could elapse between when the application\n starts (and its indexes are grokked), and the moment, maybe days\n or weeks later, when a new instance of that `grok.Site` is\n created. Hence this `IndexesSetupSubscriber`: it can be\n instantiated at grokking time with the index information, and then\n registered with the Component Architecture as an event that should\n be fired later, whenever the right kind of `grok.Site` is\n instantiated. At that point its `__call__` method is kicked off\n and it makes sure the index catalogs get created properly.\n\n '
__module__ = 'waeup.kofa.meta'
waeup.kofa.meta.disable_broken_handlers(event)[source]

This one is fired after ZODB setup.

Unregsiter handlers etc., that are broken or meant trouble in the past.