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
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.
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -