Rating content in a Plone site

May 23, 2006 at 6:11 pm

I’ve been meaning to try out Alec Mitchell’s contentratings product and tonight I finally sat down and tried installing it in a fresh Plone 2.5 test instance. The README is very comprehensive, but apparently I didn’t read it carefully enough because after putting contentratings into the Zope products directly, Zope wouldn’t restart.

Alec was on the #plone IRC channel and was kind enough to walk me through the process of configuring it. The product uses the “new school” approach which is to put it in $INSTANCE/lib/python. Once I moved it there, then Zope started up with no problem.

The next instructions in the README were to add the interface declarations in configure.zcml. Since I was just testing the product, I decided to configure as rateable the ‘Page’ content type that comes with ATContentTypes. This required adding these lines to ATContentTypes/configure.zcml:

After reporting that this still wasn’t working, Alec realized that he had omitted one critical line in configure.zcml:

Then I added the following code snippet to the bottom of CMFPlone/skins/plone_content/document_byline.pt:

Lastly, it was necessary to add these lines to the configure.zcml file to get the star images to appear:

The last line is not necessary if you are using Plone 2.5, since everything is already traversable.

What next

I proposed making a simple product which configures the relevant content types to be ratable, adds the indexes to the catalog and provides some nice looking views and portlets to display the highest rated content on the site.

I asked about making a configlet which would let the site admin choose which content types were ratable and Alec’s reply was “you just make a view that calls classImplements on the classes or directlyProvides on the instances.”

The goal is to make contentratings accessible and usable out-of-the-box. This could be a nice little weekend project.