[Product-Developers] Experiences with commenting solutions

Martin Aspeli optilude at gmx.net
Thu Jul 3 16:08:53 UTC 2008




Martin Aspeli wrote:
> 
> Not respecting the FTI option and registering a blanket adapter on for
> BaseContent is the biggest problem, though. This means that you get
> comments on things that aren't really content and there's no per-type
> setting. I fixed it with an override adapter like this:
> 

... or rather:

from zope.interface import implements
from zope.component import adapts

from iqpp.plone.commenting.interfaces import ICommentingOptions
from iqpp.plone.commenting.interfaces import ICommentable

from iqpp.plone.commenting.adapters.options import CommentingOptions

class SaneCommentingOptions(CommentingOptions):
    adapts(ICommentable)
    
    def getGlobalOption(self, name):
        if name == "is_enabled":
            try:
                return self.context.isDiscussable()
            except AttributeError:
                pass
        
        return super(SaneCommentingOptions, self).getGlobalOption(name)

Martin

-- 
View this message in context: http://www.nabble.com/Experiences-with-commenting-solutions-tp18200103s20094p18262833.html
Sent from the Product Developers mailing list archive at Nabble.com.





More information about the Product-Developers mailing list