Jeff Shell wrote:
Nope, you have to register a dispatcher first that invokes the
subscribers registered within the adapter-registry.
I'm writing a small command line tool that uses parts of Zope 3's
component architecture (zope.component, zope.interface, zope.schema),
and just includes those packages and a couple of supporting ones found
in dependencies (zope.i18nmessageid, exceptions, texting). No
zope.app, publisher, server, etc. And (at present) no C code, so no
zope.hookable either. And no ZCML.
I'd like to use events in my tool, but I'm confused. I'm having a hard
time understanding the terminology in zope.component / zope.interface
regarding Subscribers and Handlers. I don't know if those are wired to
zope.event.notify at all.
I don't know how to translate something like:
into zope.component.provide... provideHandler? provideSubscriber?
from zope.component import getGlobalSiteManager
gsm = getGlobalSiteManager()
gsm.subscribe(required, provided, factory)
the zcml example above:
gsm.subscribe((IBeforeInstallEvent,), None, ensurePaths)
A callable that takes one or more arguments corresponding to the number
of required interfaces.
I think I'm just not understanding the relationship of 'for' (in the
ZCML) to the provideHandler / provideSubscriber concepts of 'adapts'
and 'provides', and what that means for me looking to subscribe to an
event with a plain old function. Or class. Or instance.
Zope3-users mailing list