zope.component.hooks: The current component registryΒΆ

See also

zope.component.hooks: The current component registry for narrative documentation and examples.

Hooks for getting and setting a site in the thread global namespace.

zope.component.hooks.site(site) → None[source]

Context manager that sets site as the current site for the duration of the with body.

zope.component.hooks.getSiteManager(context=None)[source]

A special hook for getting the site manager.

Here we take the currently set site into account to find the appropriate site manager.

zope.component.hooks.setHooks()[source]

Make zope.component.getSiteManager and interface adaptation respect the current site.

Most applications will want to be sure te call this early in their startup sequence. Test code that uses these APIs should also arrange to call this.

zope.component.hooks.resetHooks()[source]

Reset zope.component.getSiteManager and interface adaptation to their original implementations that are unaware of the current site.

Use caution when calling this; most code will not need to call this. If code using the global API executes following this, it will most likely use the base global component registry instead of a site-specific registry it was expected. This can lead to failures in adaptation and utility lookup.