File: configure.rst

package info (click to toggle)
zope.component 4.3.0-3
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 780 kB
  • sloc: python: 5,600; makefile: 130
file content (41 lines) | stat: -rw-r--r-- 1,052 bytes parent folder | download | duplicates (3)
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
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()