[Product-Developers] plone.contentratings for Plone 4

Kees Hink hink at gw20e.com
Thu Feb 11 11:28:00 UTC 2010

I just tried plone.contentratings on a Plone 4 site, wanting to make it
compatible with Plone 4. It turns out i can't do that by myself.

The product installs (using svn trunk), and rating an object as an
authenticated user works.

However, when i rate as an anonymous user, i get a NotFound error on url :
"Object: <Products.Five.metaclass.SimpleViewClass from
/home/kees/myproject/src/contentratings/contentratings/browser/stars.pt object
at 0x8cb7e10>, name: 'rate'." The full message is on http://pastie.org/819802.
There's no info in the terminal.

While looking through changesets marked as "Plone 4 / Zope 2.12 compatibility",
i found
  When implementing a similar change on contentratings.contentratings (see diff
below), i don't get a Zope error anymore, but just a "404 Not Found".

But the truth is, i don't understand what's happening here. I did read
first, but found no pointers there.

Any pointers to documentation that might help would be greatly appreciated,
especially for general upgrade to Zope 2.12 problems, as i would like to gain
more insight there.


Index: browser/traverser.py
--- browser/traverser.py	(revision 110636)
+++ browser/traverser.py	(working copy)
@@ -4,7 +4,9 @@
 from Acquisition import ExplicitAcquisitionWrapper
 from contentratings.interfaces import IUserRating, IEditorialRating

-class user_rating(object):
+from Acquisition import Explicit
+class user_rating(Explicit, object):
     """Traversal adapter to lookup the view for a named IUserRating category.
     To demonstrate we need to make some categories and a view for those.
     First we make two categories::
Index: browser/basic.py
--- browser/basic.py	(revision 110636)
+++ browser/basic.py	(working copy)
@@ -6,6 +6,9 @@
 from contentratings.browser.interfaces import IRatingView
 from contentratings.interfaces import _
 from zope.schema.interfaces import IVocabularyTokenized
+from Acquisition import Explicit
     from Products.statusmessages.interfaces import IStatusMessage
 except ImportError:
@@ -13,7 +16,7 @@
     class IStatusMessage(Interface):

-class BasicEditorialRatingView(object):
+class BasicEditorialRatingView(Explicit, object):
     """A basic view for applying and removing user ratings.  Expects
     its context to be an IRatingManager providing IEditorialRating."""
     vocab_name = 'contentratings.browser.base_vocabs.five_star_vocab'

More information about the Product-Developers mailing list