[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
http://127.0.0.2:8080/Plone/front-page/++UserRating++/rate?value=1 :
"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
https://dev.plone.org/collective/changeset/110490/Products.Collage/addons/collective.collage.portlets/trunk/collective/collage/portlets.
  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
http://maurits.vanrees.org/weblog/archive/2009/10/migrating-a-product-to-plone-4.0
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.

Kees


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
+
 try:
     from Products.statusmessages.interfaces import IStatusMessage
 except ImportError:
@@ -13,7 +16,7 @@
     class IStatusMessage(Interface):
         pass

-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