Search code examples
plonedexterity

Can not activate discussions on Plone Dexterity types (folderish)


I have been working on a dexterity based plone application. I have created a couple of new types. This is what I did to activate comments on a specific dexterity content type named "activity_report":

In Plone Control Panel

In the Discussion section I enabled the following:

  • globally enable comments
  • enable anonymous comments

In the Types Section I chose the "Activity Report" type from the drop down and enabled the "Allow comments" option.

On the file system

In the FTI file activityreport.xml:

<property name="allow_discussion">True</property>

I have restarted the instance and even reinstalled the product, but I can not activate the comments section in the dexterity type.

It is worth mentioning that a standard type (ex. Page) can have the discussion module activated.

Is there something I am missing?


Solution

  • plone.app.discussion currently disables commenting for all containers (see https://dev.plone.org/ticket/11245 for discussion).

    I used a monkey patch like the following in one project to short-circuit the normal check and make sure that commenting was enabled for my folderish content type:

    from Acquisition import aq_inner
    from Products.highcountrynews.content.interfaces import IHCNNewsArticle
    from plone.app.discussion.conversation import Conversation
    old_enabled = Conversation.enabled
    def enabled(self):
        parent = aq_inner(self.__parent__)
        if parent.portal_type == 'my_portal_type':
            return True
        return old_enabled(self)
    Conversation.enabled = enabled
    

    where 'my_portal_type' is, of course, the portal_type you want commenting enabled for.