[Product-Developers] Re: bug with portetRenderer?

Vitaliy Podoba vitaliypodoba at gmail.com
Mon Jan 18 06:44:51 UTC 2010


Hi Dylan,

Actually that's a side effect of zope component registry because as you said 
carousel portlet inherits from collection portlet thus also provides 
ICollectionPortlet interface. 

Of course this behavior is usually not desirable while working with plone 3 
portlets. I think there are at least two workarounds for this issue:

1. Artificially add marker interface to collection portlet Assignement via 
five:implements directive and then register portletRenderer for this 
interface instead of ICollectionPortlet. Though I'm not sure it'll work as I 
don't know if directly provided interfaces are inherited...

2. Add one more portletRenderer for carousel portlet which will remain the 
same renderer for this portlet as it'll be registered for more specific 
portlet interface ICarouselPortlet.


Good luck,
Vitaliy Podoba

Dylan Jay wrote:

> Hi,
> 
> In collective.carousel is the following definition
> 
>      <plone:portlet
>          name="portlet.Carousel"
>          interface=".carousel.ICarouselPortlet"
>          assignment=".carousel.Assignment"
>          view_permission="zope2.View"
>          edit_permission="plone.portlet.collection.AddCollectionPortlet"
>          renderer=".carousel.Renderer"
>          addview=".carousel.AddForm"
>          editview=".carousel.EditForm"
>          />
> 
> carousel.Renderer etc all inherit from
> plone.portlet.collection.collection and the Renderer uses its own
> template
> 
> class Renderer(base.Renderer):
>      render = ViewPageTemplateFile('carousel.pt')
> 
> 
> This seems all fine and works well until I install a theme with the
> following zcml
> 
>      <plone:portletRenderer
>      portlet="plone.portlet.collection.collection.ICollectionPortlet"
>      layer=".interfaces.IThemeSpecific"
>      template="templates/collection.pt"
>      />
> 
> This changes the renderer for ICarouselPortlet as well as
> ICollectionPortlet and all my carousel portlets appear as collection
> portlets even though they add and edit forms still remain as carousel
> forms.
> 
> Is that expected?
> 
> 
> ---
> Dylan Jay, Plone Solutions Manager
> www.pretaweb.com
> tel:+61299552830
> mob:+61421477460
> skype:dylan_jay






More information about the Product-Developers mailing list