[Product-Developers] Re: bug with portetRenderer?
Dylan Jay
djay at pretaweb.com
Mon Jan 18 14:51:57 UTC 2010
On 18/01/2010, at 5:44 PM, Vitaliy Podoba wrote:
> 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.
Actually I said the implementation inheritted from CollectionPortlet
not the interface but looking at the code again you are right.
I removed the Interface inheritance since Carousel isn't really a
collection portlet it's just reusing some code.
class ICarouselPortlet(Interface):
"""A portlet displaying a carousel with a Collection's results
"""
however this doesn't stop the porletRenderer override :(
Is it that portlets don't work like views or that the portlet views
are registered by the class instead of the 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.
thanks. I think both would work but I still think something is going
wrong since ICarouselPortlet no longer inherits from ICollectionPortlet.
>
>
> 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
>
>
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers
More information about the Product-Developers
mailing list