blob: 83cce0c391186fb48dd07451584ac6749f3febad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
.. _adapter_directive:
``adapter``
-----------
Register a :term:`Zope Component Architecture` "adapter".
Attributes
~~~~~~~~~~
``factory``
The adapter factory (often a class).
``provides``
The :term:`interface` that an adapter instance resulting from a
lookup will provide.
``for``
Interfaces or classes to be adapted, separated by spaces,
e.g. ``interfaces.IFoo interfaces.IBar``.
``name``
The adapter name.
Example
~~~~~~~
.. code-block:: xml
:linenos:
<adapter
for=".foo.IFoo .bar.IBar"
provides=".interfaces.IMyAdapter"
factory=".adapters.MyAdapter"
/>
Alternatives
~~~~~~~~~~~~
Use the ``registerAdapter`` method of the ``registry`` attribute of a
:term:`Configurator` instance during initial application setup.
See Also
~~~~~~~~
None.
|