summaryrefslogtreecommitdiff
path: root/docs/configure.rst
blob: c32039a568c1fc3cc332382cbd2f469d57d48a58 (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
=======================
 Package configuration
=======================

.. testsetup::

   from zope.component.testing import setUp
   setUp()

The ``zope.component`` package provides a ZCML file that configures some basic
event handlers.

.. doctest::

   >>> from zope.configuration.xmlconfig import XMLConfig
   >>> import zope.component
   >>> from zope.component import event
   >>> from zope.component import registry

   >>> XMLConfig('configure.zcml', zope.component)()

   >>> gsm = zope.component.getGlobalSiteManager()
   >>> registered = list(gsm.registeredHandlers())
   >>> len(registered)
   5
   >>> handlers = [x.handler for x in registered]
   >>> event.objectEventNotify in handlers
   True
   >>> registry.dispatchUtilityRegistrationEvent in handlers
   True
   >>> registry.dispatchAdapterRegistrationEvent in handlers
   True
   >>> registry.dispatchSubscriptionAdapterRegistrationEvent in handlers
   True
   >>> registry.dispatchHandlerRegistrationEvent in handlers
   True


.. testcleanup::

   from zope.component.testing import tearDown
   tearDown()