[Zope3-dev] Doctests for IObjectModifiedEvent
Stephan Richter
srichter at cosmos.phy.tufts.edu
Wed Mar 8 16:11:00 EST 2006
On Wednesday 08 March 2006 15:18, Egon Frerich wrote:
> I want to have doctests which document the correctness of an handler for
> an IObjectModifiedEvent. But the 'notify' triggers a TypeError, because
> the handler 'takes exactly 2 arguments (1 given)'. Two arguments are
> correct.
I have a suspicion. Here is how to system works:
event = AnyObjectEvent(obj)
-> zope.event.notify(event)
-> zope.app.objectevent.objectEventNotify(event)
-> subscribers((event.object, event), None)
-> yourHandler(obj, event)
Any IObjectEvent gets handled by objectEventNotify, which in turn sends out
another subscription request for (obj, event). And you probably have a
subscriber for the latter. The easy way to test this would be to manually
write:
>>> yourHandler(event.object, event)
Regards,
Stephan
--
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
More information about the Zope3-dev
mailing list