Personal tools

Mar 01, 2010

Integration of PloneGazette with plone.app.discussion

Filed Under:

The new product collective.discussionintegration.plonegazette provides the integration of PloneGazette and plone.app.discussion.

The product plone.app.discussion is becoming the standard way to add comments in Plone. If both products plone.app.discussion and Products.PloneGazette are installed the creation of any PloneGazette content type fails, because PloneGazette content types not provide the adapter for "IConversation":

Traceback (innermost last):
  ...
  Module plone.app.discussion.catalog, line 29, in total_comments
TypeError: ('Could not adapt', <NewsletterTheme at /ausl/newslettertheme.2010-01-26.2440135204>, <InterfaceClass plone.app.discussion.interfaces.IConversation>)

 

 

To solve the problem we set an adapter for the types defined in Products.PloneGazette. This adapter provides the interface "IConversation" of plone.app.discussion. The adapter provides the attribute "total_comments" and the method "enabled", which returns False (means that the commeting is disable).

<adapter
      for="Products.PloneGazette.interfaces.INewsletterTheme"
      factory=".newsletter.NewsletterConversation"
      provides="plone.app.discussion.interfaces.IConversation"
      />

 

So you can create objects Newsletter without any problem.

Unfortunately PloneGazette does not define an interface for each content types, so through zcml we say that these content type implements a particular interfaces.Then we give the adapter for those interfaces.


The new product collective.discussionintegration.plonegazette makes possible the creation of the PloneGazette content types if there is an installation of plone.app.discussion in your instance.

http://svn.plone.org/svn/collective/collective.discussionintegration.plonegazette/