Various component utilities.

Function _registryActive A context manager that activates and deactivates a zope adapter registry for the duration of the call.
Function _registryAdapting Construct a Zope Interface adapter registry.
@contextmanager
def _registryActive(registry):

A context manager that activates and deactivates a zope adapter registry for the duration of the call.

For example, if you wanted to have a function that could adapt IFoo to IBar, but doesn't expose that adapter outside of itself:

   def convertToBar(maybeFoo):
       with _registryActive(_registryAdapting((IFoo, IBar, fooToBar))):
           return IBar(maybeFoo)
ParametersregistryThe registry to activate. (type: AdapterRegistry)
Returns (type: )
NoteThis isn't thread safe, so other threads will be affected as well.
def _registryAdapting(*fromToAdapterTuples):

Construct a Zope Interface adapter registry.

For example, if you want to construct an adapter registry that can convert IFoo to IBar with fooToBar.

ParametersfromToAdapterTuplesA sequence of tuples of (fromInterface, toInterface, adapterCallable), where fromInterface and toInterface are IInterfaces, and adapterCallable is a callable that takes one argument which provides fromInterface and returns an object providing toInterface. (type: tuple of 3-tuples of (Interface, Interface, callable))
Returnsan adapter registry adapting the given tuples. (type: AdapterRegistry)
API Documentation for tubes, generated by pydoctor at 2016-01-18 07:46:47.