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.|
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
IBar, but doesn't expose that adapter
outside of itself:
def convertToBar(maybeFoo): with _registryActive(_registryAdapting((IFoo, IBar, fooToBar))): return IBar(maybeFoo)
|Parameters||registry||The registry to activate. (type: |
|Note||This isn't thread safe, so other threads will be affected as well.|
Construct a Zope Interface adapter registry.
For example, if you want to construct an adapter registry that can
|Parameters||fromToAdapterTuples||A sequence of tuples of |
|Returns||an adapter registry adapting the given tuples. (type: |