Site Managers act as containers for registerable components.
If a Site Manager is asked for an adapter or utility, it checks for those it contains before using a context-based lookup to find another site manager to delegate to. If no other site manager is found they defer to the global site manager which contains file based utilities and adapters.
subs
(Attribute)
A collection of registries that describe the next level of the registry tree. They are the children of this registry node. This attribute should never be manipulated manually. Use `addSub()` and `removeSub()` instead.
utilities
(Attribute)
Adapter Registry to manage all registered utilities.
adapters
(Attribute)
Adapter Registry to manage all registered adapters.
* = required
unregisterHandler(handler=None, required=None, name=u'')
Unregister a handler.
A handler is a subscriber that doesn't compute an adapter but performs some function when called.
A boolean is returned indicating whether the registry was changed.
Parameters:
handler This is the object used to handle some event represented by the objects passed to it. The handler can be None, in which case any handlers registered for the given required specifications with the given are unregistered.
required This is a sequence of specifications for objects to be adapted. If omitted, then the value of the factory's __component_adapts__ attribute will be used. The __component_adapts__ attribute is usually attribute is normally set in class definitions using adapts function, or for callables using the adapter decorator. If the factory doesn't have a __component_adapts__ adapts attribute, then this argument is required.
name The handler name.
Currently, only the empty string is accepted. Other strings will be accepted in the future when support for named handlers is added.
An Unregistered event is generated with an IHandlerRegistration.
registeredAdapters()
Return an iterable of IAdapterRegistrations.
These registrations describe the current adapter registrations in the object.
unregisterUtility(component=None, provided=None, name=u'')
Unregister a utility
A boolean is returned indicating whether the registry was changed. If the given component is None and there is no component registered, or if the given component is not None and is not registered, then the function returns False, otherwise it returns True.
component The registered component The given component can be None, in which case any component registered to provide the given provided interface with the given name is unregistered.
provided This is the interface provided by the utility. If the component is not None and provides a single interface, then this argument is optional and the component-implemented interface will be used.
name The utility name.
An UnRegistered event is generated with an IUtilityRegistration.
unregisterSubscriptionAdapter(factory=None, required=None, provides=None, name=u'')
Unregister a subscriber factory.
A boolean is returned indicating whether the registry was changed. If the given component is None and there is no component registered, or if the given component is not None and is not registered, then the function returns False, otherwise it returns True.
Parameters:
factory This is the object used to compute the adapter. The factory can be None, in which case any factories registered to implement the given provided interface for the given required specifications with the given name are unregistered.
required This is a sequence of specifications for objects to be adapted. If the factory is not None and the required arguments is omitted, then the value of the factory's __component_adapts__ attribute will be used. The __component_adapts__ attribute attribute is normally set in class definitions using adapts function, or for callables using the adapter decorator. If the factory is None or doesn't have a __component_adapts__ adapts attribute, then this argument is required.
provided This is the interface provided by the adapter and implemented by the factory. If the factory is not None implements a single interface, then this argument is optional and the factory-implemented interface will be used.
name The adapter name.
Currently, only the empty string is accepted. Other strings will be accepted in the future when support for named subscribers is added.
An Unregistered event is generated with an ISubscriptionAdapterRegistration.
registerSubscriptionAdapter(factory, required=None, provides=None, name=u'', info='')
Register a subscriber factory
Parameters:
factory The object used to compute the adapter
required This is a sequence of specifications for objects to be adapted. If omitted, then the value of the factory's __component_adapts__ attribute will be used. The __component_adapts__ attribute is usually attribute is normally set in class definitions using adapts function, or for callables using the adapter decorator. If the factory doesn't have a __component_adapts__ adapts attribute, then this argument is required.
provided This is the interface provided by the adapter and implemented by the factory. If the factory implements a single interface, then this argument is optional and the factory-implemented interface will be used.
name The adapter name.
Currently, only the empty string is accepted. Other strings will be accepted in the future when support for named subscribers is added.
info An object that can be converted to a string to provide information about the registration.
A Registered event is generated with an ISubscriptionAdapterRegistration.
getAllUtilitiesRegisteredFor(interface)
Return all registered utilities for an interface
This includes overridden utilities.
An iterable of utility instances is returned. No names are returned.
registeredHandlers()
Return an iterable of IHandlerRegistrations.
These registrations describe the current handler registrations in the object.
queryMultiAdapter(objects, interface, name=u'', default=None)
Look for a multi-adapter to an interface for multiple objects
If a matching adapter cannot be found, returns the default.
registerUtility(component, provided=None, name=u'', info=u'')
Register a utility
component The registered component
provided This is the interface provided by the utility. If the component provides a single interface, then this argument is optional and the component-implemented interface will be used.
name The utility name.
info An object that can be converted to a string to provide information about the registration.
A Registered event is generated with an IUtilityRegistration.
getMultiAdapter(objects, interface, name=u'')
Look for a multi-adapter to an interface for multiple objects
If a matching adapter cannot be found, a ComponentLookupError is raised.
queryAdapter(object, interface, name=u'', default=None)
Look for a named adapter to an interface for an object
If a matching adapter cannot be found, returns the default.
removeSub(sub)
Remove a sub-registry to the node.
Important: This method should not be used manually. It is automatically called by `setNext()`. To remove a registry from the tree, use `sub.setNext(None)` instead!
queryUtility(interface, name='', default=None)
Look up a utility that provides an interface.
If one is not found, returns default.
handle(*objects)
Call handlers for the given objects
Handlers registered for the given objects are called.
getAdapters(objects, provided)
Look for all matching adapters to a provided interface for objects
Return an iterable of name-adapter pairs for adapters that provide the given interface.
getUtilitiesFor(interface)
Look up the registered utilities that provide an interface.
Returns an iterable of name-utility pairs.
registeredSubscriptionAdapters()
Return an iterable of ISubscriptionAdapterRegistrations.
These registrations describe the current subscription adapter registrations in the object.
subscribers(objects, provided)
Get subscribers
Subscribers are returned that provide the provided interface and that depend on and are comuted from the sequence of required objects.
registerAdapter(factory, required=None, provided=None, name=u'', info=u'')
Register an adapter factory
Parameters:
factory The object used to compute the adapter
required This is a sequence of specifications for objects to be adapted. If omitted, then the value of the factory's __component_adapts__ attribute will be used. The __component_adapts__ attribute is usually attribute is normally set in class definitions using adapts function, or for callables using the adapter decorator. If the factory doesn't have a __component_adapts__ adapts attribute, then this argument is required.
provided This is the interface provided by the adapter and implemented by the factory. If the factory implements a single interface, then this argument is optional and the factory-implemented interface will be used.
name The adapter name.
info An object that can be converted to a string to provide information about the registration.
A Registered event is generated with an IAdapterRegistration.
registerHandler(handler, required=None, name=u'', info='')
Register a handler.
A handler is a subscriber that doesn't compute an adapter but performs some function when called.
Parameters:
handler The object used to handle some event represented by the objects passed to it.
required This is a sequence of specifications for objects to be adapted. If omitted, then the value of the factory's __component_adapts__ attribute will be used. The __component_adapts__ attribute is usually attribute is normally set in class definitions using adapts function, or for callables using the adapter decorator. If the factory doesn't have a __component_adapts__ adapts attribute, then this argument is required.
name The handler name.
Currently, only the empty string is accepted. Other strings will be accepted in the future when support for named handlers is added.
info An object that can be converted to a string to provide information about the registration.
A Registered event is generated with an IHandlerRegistration.
getAdapter(object, interface, name=u'')
Look for a named adapter to an interface for an object
If a matching adapter cannot be found, a ComponentLookupError is raised.
unregisterAdapter(factory=None, required=None, provided=None, name=u'')
Register an adapter factory
A boolean is returned indicating whether the registry was changed. If the given component is None and there is no component registered, or if the given component is not None and is not registered, then the function returns False, otherwise it returns True.
Parameters:
factory This is the object used to compute the adapter. The factory can be None, in which case any factory registered to implement the given provided interface for the given required specifications with the given name is unregistered.
required This is a sequence of specifications for objects to be adapted. If the factory is not None and the required arguments is omitted, then the value of the factory's __component_adapts__ attribute will be used. The __component_adapts__ attribute attribute is normally set in class definitions using adapts function, or for callables using the adapter decorator. If the factory is None or doesn't have a __component_adapts__ adapts attribute, then this argument is required.
provided This is the interface provided by the adapter and implemented by the factory. If the factory is not None and implements a single interface, then this argument is optional and the factory-implemented interface will be used.
name The adapter name.
An Unregistered event is generated with an IAdapterRegistration.
registeredUtilities()
Return an iterable of IUtilityRegistrations.
These registrations describe the current utility registrations in the object.
addSub(sub)
Add a new sub-registry to the node.
Important: This method should not be used manually. It is automatically called by `setNext()`. To add a new registry to the tree, use `sub.setNext(self, self.base)` instead!
There are no specific adapters registered for this interface.