[Product-Developers] Experiences with commenting solutions

Martin Aspeli optilude at gmx.net
Thu Jul 3 14:42:51 UTC 2008




Andreas Jung-5 wrote:
> 
> I can only say that iqpp.p.c works like a charm. The only thing I am 
> missing is that it does respect the "allow comments" setting within the 
> Types control panel.
> 

It's working well for us now as well.

There are a couple of things about iqpp.plone.commenting that I think
warrants fixing if people are still working on it. None are very big,
though.

A minor niggle is that the fields in the custom templates don't use
class="field" on their divs, making them look funny. :) Another is that the
ICommentingOptions adapter seems to create annotations on the fly in
__init__() (i.e. when it's adapted) which is pretty bad since it could lead
to write-on-read situations. Oh, and it installs an action called "options"
that is available even on types where the view it links to are not. Using
the schema extender on ICommentable would be better.

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:

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:
                fti = self.context.getTypeInfo()
                return fti.allowDiscussion()
            except AttributeError:
                pass
        
        return super(SaneCommentingOptions, self).getGlobalOption(name)

I think it's a bit annoying that these things are using string-based option
checking, but oh well. All in all, the product is very good.

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





More information about the Product-Developers mailing list