Friday, November 14, 2008

Subscribers Zope 3 style

Vernon Chapman shared this with me. Very elegant.

configure.zcml (brackets replacing XML open/close because Blogspot sucks!)
[subscriber for="Products.CMFCore.interfaces.IActionSucceededEvent"
handler=".handlers.vernstuff_content_thing" /]
handlers module
def vernstuff_content_thing(event):
"""This will do all the work"""
action_as_string = event.action
content = event.object
# Do whatever you like here

No comments: