Plone 5 Message on Event (IObjectAdded) doesn't work

Hello,

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):
(...)
<do something>

and added a new subscriber to configure.zcml:

  <subscriber
    for="tdf.extensionuploadcenter.eupcenter.IEUpCenter
               zope.lifecycleevent.interfaces.IObjectAddedEvent"
    handler="tdf.extensionuploadcenter.eupcenter.notifyAboutNewProject"
    />

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.
Andreas

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.

Regards,
Andreas

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.

Regards,
Andreas

I added another function with an event handler.

in configure.zcml:

This event handler from CMFCore works fine. It seemed the issue is with the event handler from zope.lifecycleevent.

Regards,
Andreas

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.

-Roel