[Product-Developers] Re: plone.contentratings for Plone 4

Kees Hink hink at gw20e.com
Mon Feb 15 13:51:58 UTC 2010

The problem isn't with Anonymous/Authenticated, but with the "rate" method on
the ++UserRating++ view. This is inaccessible for both types of users.
(However, with KSS enabled for Anonymous, rating still doesn't work, while it
does work for Authenticated.)

Going to
yields an error:
NotFound: Object: <Products.Five.metaclass.SimpleViewClass from
/home/kees/myproject/src/contentratings/contentratings/browser/stars.pt object
at 0x8e594d0>, name: 'rate'

The error log shows it's
Products.Five.browser.metaconfigure.ViewMixinForTemplates, which fails in
def publishTraverse(self, request, name):
        if name == 'index.html':
            return self.index
        raise NotFound(self, name, request)
"name" here is 'rate', so that explains it.

++UserRating++ is defined in contentratings/browser/configure.zcml:

I'm don't know why viewing this works, and viewing an attribute doesn't. I've
tried adding
      allowed_attributes="rate remove_rating"
, but that doesn't help.

Any suggestions for further investigation?

Kees Hink wrote:
> I fixed some tests in contentratings/trunk, so they pass in Plone 4. I also
> included the patch (mentioned earlier in this thread) to subclass views from
> 'Acquisition.Explicit'. Still works on Plone 3 as well.
> On i go...
> Kees Hink wrote:
>> The mentioned test passes when testing via ./bin/test -s contentratings. So the
>> failing was probably due to missing zcml setup.
>> Raphael Ritz wrote:
>>> Kees Hink wrote:
>>>> While browsing the documentation of contentrating and executing the
>>>> python code
>>>> in a ./bin/zopepy shell, i ran into this (README.txt:93):
>>>>>>> adapted = IUserRating(content)
>>>> Traceback (most recent call last):
>>>>   File "<console>", line 1, in <module>
>>>> TypeError: ('Could not adapt', <zope.container.sample.SampleContainer
>>>> object at
>>>> 0x2ad8910>, <InterfaceClass contentratings.interfaces.IUserRating>)
>>> Wild guess: The adapter to IUserRating is registered for
>>> an interface (or interfaces) that are no longer provided
>>> by some or all relevant content items.
>>> If that's the case, one would either have to mark those
>>> content types accordingly or adjust/extend the adapter
>>> registration.
>>> No clue whether that points you in the right direction though,
>>>     Raphael
>>>> Could this be the cause of the problem, or is this due to some zcml
>>>> setup which
>>>> is not taken into account when running the code from the zopepy shell?
>>>> I also tried testing using zc.recipe.testrunner, but i don't have this
>>>> working yet.
>>>> Kees

More information about the Product-Developers mailing list