[Product-Developers] Stuck overriding a stock Ploine viewlet...

Gilles Lenfant gilles.lenfant at alterway.fr
Fri Feb 10 08:06:05 UTC 2012


Le 9 février 2012 21:07, Jean-Michel FRANCOIS <toutpt at gmail.com> a écrit :

> Hi Gilles,
>
> Last time I had this issue, it was a custom in portal_viewcustomerize ;)
> check this one !
>

Hi Toutpt

Already checked ! No, I can reproduce this in a vanilla Plone 4.1 site with
only my component.

This said, overriding a stock Plone viewlet class the canonical way is
somehow overkill. A clever and well documented monkey patch using
collective.monkeypatcher(panel) with respect to the layer is easier in most
situations.

Cheers,
-- 
Gilles Lenfant


>
> Regards / Cordialement,
> JeanMichel FRANCOIS
> Find me on Google + <https://profiles.google.com/toutpt>
>
>
>
>
> 2012/2/9 Gilles Lenfant <gilles.lenfant at alterway.fr>
>
>>
>>
>> Le 9 février 2012 12:01, Simone Orsi <simahawk at gmail.com> a écrit :
>>
>>>  Hi Gilles,
>>>
>>
>> Hi Simone,
>>
>>
>>>
>>> dumb question: did you check if your layer has been registered and has
>>> marked the request?
>>>
>>
>> Not that dumb ;) But of course this is one of the first things I have
>> been investingating into.
>>
>> And the various <browser:page > stuff registered for the same layer work
>> like a charm.
>>
>>
>>>
>>> If it doesn't I think you can work around this by giving a custom name
>>> to your viewlet and add a viewlets.xml where you hide the original one and
>>> display yours.
>>>
>>
>> That's the fallback i'll take if I can't override the original viewlet.
>> This is somehow "dirty" but this should work.
>>
>> Thanks a lot
>> --
>> Gilles
>>
>>
>>>
>>> Cheers,
>>> SimO
>>>
>>>
>>> On 09/02/12 09:18, Gilles Lenfant wrote:
>>>
>>> Le 9 février 2012 06:54, ajung <lists at zopyx.com> a écrit :
>>>
>>>> If you need to override only the template then use z3.jbot.
>>>>
>>>>
>>> Hi,
>>>
>>> No, I need to override only the viewlet class. z3c.jbot can't help me in
>>> that case.
>>>
>>> Best...
>>> --
>>> Gilles Lenfant
>>>
>>>  -aj
>>>>
>>>>
>>>> Gilles Lenfant-2 wrote
>>>>  >
>>>> > Hi,
>>>> >
>>>> > Sorry for the disturbance, but I'm actually stuck overriding a
>>>> standard
>>>> > viewlet of Plone (4.1): The "plone.links.RSS" that goes in the HTML
>>>> head.
>>>> >
>>>> > Though I carefully read and practiced the tutorial
>>>> >
>>>> http://plone.org/documentation/kb/customizing-main-template-viewlets/overriding-a-class-viewletI
>>>> > always have the original Plone viewlet from plone.app.layout.links.
>>>> >
>>>> > Some pointers that show how I did this :
>>>> >
>>>> > My component's layer :
>>>> >
>>>> https://github.com/glenfant/aws.authrss/blob/master/src/aws/authrss/interfaces.py#L8
>>>> >
>>>> > Its installation through GenericSetup works correctly since it shows
>>>> in
>>>> > ZMI
>>>> > in the "Components" tab of the Plone site.
>>>> >
>>>> > The ZCML registration of the viewlet including that layer selector:
>>>> >
>>>> https://github.com/glenfant/aws.authrss/blob/master/src/aws/authrss/browser/configure.zcml#L86
>>>> >
>>>> > The viewlet class itself:
>>>> >
>>>> https://github.com/glenfant/aws.authrss/blob/master/src/aws/authrss/browser/viewlets.py#L10
>>>> >
>>>> > I'm stuck finding why this does not work as expected (the original
>>>> viewlet
>>>> > is rendered in place of my custom viewlet). Any help is welcome. And
>>>> so
>>>> > many thanks by advance for any pointer.
>>>> >
>>>> > --
>>>> > Gilles Lenfant
>>>> >
>>>>  > _______________________________________________
>>>> > Product-Developers mailing list
>>>> > Product-Developers at .plone
>>>> > https://lists.plone.org/mailman/listinfo/plone-product-developers
>>>> >
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://plone.293351.n2.nabble.com/Stuck-overriding-a-stock-Ploine-viewlet-tp7266769p7268283.html
>>>> Sent from the Product Developers mailing list archive at Nabble.com.
>>>>  _______________________________________________
>>>> Product-Developers mailing list
>>>> Product-Developers at lists.plone.org
>>>> https://lists.plone.org/mailman/listinfo/plone-product-developers
>>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Product-Developers mailing listProduct-Developers at lists.plone.orghttps://lists.plone.org/mailman/listinfo/plone-product-developers
>>>
>>>
>>>
>>> _______________________________________________
>>> Product-Developers mailing list
>>> Product-Developers at lists.plone.org
>>> https://lists.plone.org/mailman/listinfo/plone-product-developers
>>>
>>>
>>
>>
>> --
>> --
>> Gilles LENFANT
>> Ingénieur avant-vente - Architecte senior
>> ALTER WAY SOLUTIONS
>> T : 01 78 15 24 00
>> F : 01 46 02 44 04
>>
>> Téléchargez notre nouveau livre blanc "Python, le développement autrement"
>> http://www.alterway.fr/publications/python-le-developpement-autrement
>>
>> 1 rue Royal, Bat. D
>> 227, les Bureaux de la Colinne
>> 92210 Saint Cloud
>> http://www.alterway.fr/solutions
>>
>> _______________________________________________
>> Product-Developers mailing list
>> Product-Developers at lists.plone.org
>> https://lists.plone.org/mailman/listinfo/plone-product-developers
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20120210/65ef3a7f/attachment.html>


More information about the Product-Developers mailing list