I try to move a message sending from grok style to confiigure.zcml with a subscriber but that doesn't work as decribed in the Plone 5 developer documentation. I had already this function in my Dexterity object:
def notifyAboutNewProject(eupproject, event):
and added a new subscriber to configure.zcml:
But there seemed to be no event fired up once a new file is added to the eupcenter folder. I never get a message in the shell (debug mode with Printing Host).
Thanks for any hint.
Code looks ok afaict.
First I would check if the zcml is loaded at all. Simplest way to try it: Create an syntax error in xml, if Plone still starts its not loaded.
Thanks for your reply.
I tried with a typo in the configure.zcml and I got an error message in the shell, once I run ./instance fg.
I will add a pdb statement to the function and see what happens.
A test with import pdb ; pdb.set_trace() has no effect. It never reached that line once I added a new content item to the folder.
I added another function with an event handler.
This event handler from CMFCore works fine. It seemed the issue is with the event handler from zope.lifecycleevent.
My guess is that your handler should be for IEUpProject, not IEUpCenter.
AFAIK IObjectAddedEvent is registered for the interface of the object that will be added, not the interface of the container to which the object is added.