File: components.rst

package info (click to toggle)
zope.interface 7.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,516 kB
  • sloc: python: 14,848; ansic: 1,878; makefile: 144
file content (84 lines) | stat: -rw-r--r-- 2,465 bytes parent folder | download | duplicates (2)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
======================
 Component Registries
======================

The component registry's API is defined by
``zope.interface.interfaces.IComponents``:

.. autointerface:: zope.interface.interfaces.IComponentLookup
   :members:
   :member-order: bysource


.. autointerface:: zope.interface.interfaces.IComponentRegistry
   :members:
   :member-order: bysource

.. autointerface:: zope.interface.interfaces.IComponents
   :members:
   :member-order: bysource

One default implementation of `~zope.interface.interfaces.IComponents` is provided.

.. autoclass:: zope.interface.registry.Components

Events
======

Adding and removing components from the component registry create
registration and unregistration events. Like most things, they are
defined by an interface and a default implementation is provided.

Registration
------------

.. autointerface:: zope.interface.interfaces.IObjectEvent
.. autointerface:: zope.interface.interfaces.IRegistrationEvent

.. autointerface:: zope.interface.interfaces.IRegistered
.. autoclass:: zope.interface.interfaces.Registered

.. autointerface:: zope.interface.interfaces.IUnregistered
.. autoclass:: zope.interface.interfaces.Unregistered


Details
-------

These are all types of ``IObjectEvent``, meaning they have an object
that provides specific details about the event. Component registries
create detail objects for four types of components they manage.

All four share a common base interface.

.. autointerface:: zope.interface.interfaces.IRegistration

* Utilities

  .. autointerface:: zope.interface.interfaces.IUtilityRegistration
  .. autoclass:: zope.interface.registry.UtilityRegistration

* Handlers

  .. autointerface:: zope.interface.interfaces.IHandlerRegistration
  .. autoclass:: zope.interface.registry.HandlerRegistration

* Adapters

  For ease of implementation, a shared base class is used for these
  events. It should not be referenced by clients, but it is documented
  to show the common attributes.

  .. autointerface:: zope.interface.interfaces._IBaseAdapterRegistration

  .. autointerface:: zope.interface.interfaces.IAdapterRegistration
  .. autoclass:: zope.interface.registry.AdapterRegistration

  .. autointerface:: zope.interface.interfaces.ISubscriptionAdapterRegistration
  .. autoclass:: zope.interface.registry.SubscriptionRegistration

Exceptions
==========

.. autoclass:: zope.interface.interfaces.ComponentLookupError
.. autoclass:: zope.interface.interfaces.Invalid