[Zope3-Users] Re: event subscribers
Florent Guillaume
fg at nuxeo.com
Wed Oct 5 10:53:40 EDT 2005
Pete Taylor wrote:
> hi all... question for any event subscriber gurus (or just anyone who knows
> more than me, which probably won't take much ;) )
>
> i have a set of actions that i would like to have trigger off of a
> particular state in a workflow. in my unittest i can see that the workflow
> fires the event, but my subscriber doesn't pick up on it. similarly, the
> subscriber i have in zcml in the application proper does not respond when
> the workflow transition event is fired.
>
> the functionality works if i explicitly call my subscription method against
> the event, but that only proves that the functionality of the code isn't
> broken...
>
> the relevant zcml portion is as follows:
> <subscriber
> for="qarelease.interfaces.IRelease
> zope.app.workflow.stateful.interfaces.IAfterTransitionEvent"
> factory=".release.notifyTransition"
> />
>
> the unittest subscribes with ztapi as follows:
> ztapi.subscribe((IRelease, IAfterTransitionEvent), None, notifyTransition)
As Jim mentioned, and as I discovered yesterday :), the ability to subscribe
using a multi-adapter is not "stock" behavior of the basic event
notification (which only sends one IEvent object), but actually behavior of
the IObjectEvents, which have a special subscriber re-dispatching on both
event.object and event, so that the multi-adapter subscribers can work.
What workflow framework are you using ? And what's
qarelease.interfaces.IRelease ? Is it a transition or something else ?
That framework could be updated to do the same dance, if there's a clear
"object" there. Or maybe some workflow event interfaces could be subclassed
from IObjectEvent.
Florent
--
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope3-users
mailing list