Re: z3c.unconfigure not unconfiguring subscriber
Rick Bruch <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.user |
|---|---|
| Message-ID | <7e2f756a8044497087017d8a69632d33@DM2PR0801MB0764.namprd08.prod.outlook.com> |
Thanks Dieter. I was able to find the specific zcml file that registered the subscriber and include it without any side effects. After that the unregistration worked as expected.
For reference, here is the final overrides.zcml:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:zcml="http://namespaces.zope.org/zcml"
i18n_domain="plone.app.discussion">
<include package="z3c.unconfigure" file="meta.zcml" />
<include package="plone.app.discussion" file="notifications.zcml" />
<unconfigure>
<subscriber
for="plone.app.discussion.interfaces.IComment
zope.lifecycleevent.interfaces.IObjectAddedEvent"
handler="plone.app.discussion.comment.notify_moderator"
/>
</unconfigure>
<subscriber
for="plone.app.discussion.interfaces.IComment
zope.lifecycleevent.interfaces.IObjectAddedEvent"
handler=".mycomment.notify_moderator"
/>
</configure>
-Rick
-----Original Message-----
From: dieter [mailto:[email protected]]
Sent: Thursday, July 10, 2014 11:35 PM
To: [email protected]
Subject: Re: [Plone-Users] z3c.unconfigure not unconfiguring subscriber
Rick Bruch <[email protected]> writes:
> I'm trying to replace a subscriber action with a custom one. In
> particular, I'm attempting to change the moderator notification e-mail
> that is generated from plone.app.discussion comments.
>
> I was able to do this successfully on one of my sites, but on another
> site it appears that the original subscriber is not unconfigured and I
> get two notification e-mails (the original and my modified one). No
> errors or warnings in error_log or when running bin/instance fg.
The "unconfigure" has no effect if what should be unconfigured has not yet been configured. As Johannes has already pointed out, the standard way to avoid this it to force a previous configuration by include the correponding package before the "unconfigure".
In another message, you have reported that you have already tried Johannes' suggestion:
> Unfortunately including plone.app.discussion seems to cause a problem: the CAPTCHA which I have enabled through the p.a.discussion control panel doesn't show up, and when a comment is submitted, I get a "WrongCaptchaCode" exception traceback.
>
> I'm not sure if there's a way to include a more specific part of p.a.discussion or if another approach is the way to go...
You may look in which "ZCML" file (or subpackage) of "plone.app.discussion"
the subscriber is registered and only "include" that file (or subpackage) before the "unconfigure".
I do not see why "include"ing "plone.app.discussion" should cause the problem you observe, though. Maybe, this package uses "overrides" by itself and gets confused (I mistrust the "overrides" feature of ZCML -- it already has surprised my several times). If you cannot localize the subscriber registration, you might try to do your "unconfigure"
outside an "includeOverrides".
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________
Plone-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plone-users
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds