[Zope-dev] [Warning] Zope 3 component architecture (CA) not reliably usable for registrations from Python

Dieter Maurer dieter at handshake.de
Wed Jan 10 04:01:23 EST 2007

I tried to use Zope3 events to get informed when requests start and end.

One of our modules (the interface module to "jpype") requires such
a notification for reliable work. Therefore, it tried to register
the corresponding subscriptions on import of this module.
Unfortunately, this works very unreliably -- for the following reasons:

  The CA performs by itself only extremely minimal initialization.
  Especially, it does not register the "Adapters" service, necessary
  for the registration of event subscriptions.

  The full CA initialization is only performed quite late, in the call
  to "Products.Five.initialize".
  Event notification registration attempts before this time will fail
  (with a "ComponentLookupError: 'Adapters'"), 
  those performed after this time will succeed.

The "Five" initialization is stupid enough that it will fail
when the service registration for 'Adapters' has already been performed.

At the current state, event notifications can reliably only be defined 
via ZCML. This is unfortunate for our use case where the registration
should be bound to the import of a given module.


More information about the Zope-Dev mailing list