[Zope3-Users] event subscribers
Jim Fulton
jim at zope.com
Wed Oct 5 06:03:25 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)
>
> this seems, from both srichter's book and philiKON's book to be the
> right way to do this (moving from ztapi.handle to ztapi.subscribe since
> handle is being deprecated).
>
> does anyone have any experience in attempting to do anything like this?
Normallym event subscribers are single-object adapters. In some cases,
we have subscrobers that redispatch on multiple objects. For example,
object events have a subscriber that redispatches events based on the
object and event. You expect something similar to be going on for workflow
events, but I suspect there isn't.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-users
mailing list