Skip to content.

Etria Lists

 

[quills-dev] portlets and IPossibleWeblogEntry

Michael Dunstan michael.dunstan at gmail.com
Fri Jul 11 03:46:31 UTC 2008


On Thu, Jul 10, 2008 at 10:23 PM, Tim Hicks <tim at sitefusion.co.uk> wrote:
> Hi Michael,
>
> Michael Dunstan wrote:
>>
>> Hi,
>>
>> I'm having a problem when I attempt to mark a custom content type as
>> IPossibleWeblogEntry.
>
> It's nice to see people working on this sort of thing :).
>
>> I get an error in the portlet rendering when
>> attempting to navigate to one of these content types before it has
>> been activated as a blog:
>>
>> 2008-07-09 12:50:22 ERROR portlets Error while determining renderer
>> availability of portlet {'category': 'interface_category',
>> 'assignment': <Assignment at recentcomments>, 'name':
>> u'recentcomments', 'key': 'quills.core.interfaces.weblog.IWeblog'}:
>> ((None, <HTTPRequest,
>> URL=http://localhost:11001/admin/example/base_view>), <InterfaceClass
>> zope.interface.Interface>, 'manage_comments')
>> Traceback (most recent call last):
>>  File
>> "/opt/eggs/plone.portlets-1.1.0-py2.4.egg/plone/portlets/manager.py",
>> line 105, in _lazyLoadPortlets
>>    isAvailable = renderer.available
>>  File
>> "/opt/eggs/quills.app-1.7.0b1-py2.4.egg/quills/app/portlets/recentcomments.py",
>> line 57, in available
>>    return len(self.getComments) > 0
>>  File
>> "/opt/eggs/quills.app-1.7.0b1-py2.4.egg/quills/app/portlets/recentcomments.py",
>> line 66, in getComments
>>    view = getMultiAdapter((weblog_content, self.request),
>> name='manage_comments')
>>  File
>> "/opt/sites/innovationz/trunk/parts/zope2/lib/python/zope/component/_api.py",
>> line 103, in getMultiAdapter
>>    raise ComponentLookupError(objects, interface, name)
>> ComponentLookupError: ((None, <HTTPRequest,
>> URL=http://localhost:11001/admin/example/base_view>), <InterfaceClass
>> zope.interface.Interface>, 'manage_comments')
>>>
>>>
>>> /opt/sites/innovationz/trunk/parts/zope2/lib/python/zope/component/_api.py(103)getMultiAdapter()
>>
>> -> raise ComponentLookupError(objects, interface, name)
>>
>> However things seem to work just fine if I remove the following
>> adapter from quills/app/portlets/configure.zcml:
>>
>>  <adapter
>>      for="quills.core.interfaces.IPossibleWeblogEntry"
>>      provides="plone.portlets.interfaces.IPortletContext"
>>      factory=".context.WeblogAwarePortletContext" />
>>
>> Can that be removed from trunk without any consequences?
>
> Off the top of my head, I think that might be slightly problematic as things
> stand at the moment.  Classes get marked with IPossibleWeblogEntry if they
> *could* be treated as weblog entries. Removing this declaration would stop
> Quills' portlets from getting displayed for those sorts of objects (when
> they live inside something blogish).
>
> The problem would seem to be that the recentcomments portlet is getting
> rendered when it shouldn't be - i.e. because the IPossibleWeblogEntry
> apparently doesn't yet live inside an object that is marked as
> IWeblogEnhanced.  It seems like the 'available' method on the portlet is
> perhaps not giving the correct answer.
>
> Are you able to investigate that?

Aha. That was pretty simple. I was coding up my custom content type as
implementing IPossibleWeblogEntry. Removing that form my content type
resolves the problem here.

I had missread what IPossibleWeblogEntry was for. I was thinking I
needed that to say that my new content type might be used within in a
IWeblogEnhanced.


-- 
Michael Dunstan


More information about the quills-dev mailing list