Class
zope.app.pagetemplate.engine.AdapterNamespaces

Simulate tales function namespaces with adapter lookup.

When we are asked for a namespace, we return an object that actually computes an adapter when called:

To demonstrate this, we need to register an adapter:

>>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
>>> from zope.app.testing import ztapi
>>> def adapter1(ob):
...     return 1
>>> ztapi.provideAdapter(None, IPathAdapter, adapter1, 'a1')

Now, with this adapter in place, we can try out the namespaces:

>>> ob = object()
>>> namespaces = AdapterNamespaces()
>>> namespace = namespaces['a1']
>>> namespace(ob)
1
>>> namespace = namespaces['a2']
>>> namespace(ob)
Traceback (most recent call last):
...
KeyError: 'a2'

Cleanup:

>>> tearDown()

Base classes

Implemented Interfaces

There are no implemented interfaces.

Attributes/Properties

There are no attributes in this class.

Methods

There are no methods in this class.

Known Subclasses

There are no known subclasses.