registering a viewlet for multiple dexterity content types (from policy product)

classic Classic list List threaded Threaded
3 messages Options
khink khink
Reply | Threaded
Open this post in threaded view
|

registering a viewlet for multiple dexterity content types (from policy product)

I'd like to register a viewlet for multiple dexterity content types, to
cut down on the long list of registrations of the same viewlet for
multiple types that i have in viewlets/configure.zcml. There's a lot of
duplication there.

With archetypes, i used to create a marker interface IHasViewlet and
make my content types implement this interface in ZCML [1] like so:
   <class class="path.to.class">
     <implements
        interface=".interfaces.IHasViewlet" />
   </class>

But with dexterity types, i don't have a class to point to. I looked
into plone.behavior’s marker support [2]. I ran into this problem:

The viewlet should be enabled in our policy product, because it depends
on different components. I'd like to keep the viewlet registration in
one place (policy product). But it looks like the plone.behavior
statement (primary marker behavior) should go into the respective
content types' packages, right?

Kees

[1]
http://plone.293351.n2.nabble.com/registering-a-viewlet-for-multiple-interfaces-td5125718.html

[2]
http://dexterity-developer-manual.readthedocs.org/en/latest/behaviors/providing-marker-interfaces.html


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
David Glick (GW) David Glick (GW)
Reply | Threaded
Open this post in threaded view
|

Re: registering a viewlet for multiple dexterity content types (from policy product)

On 6/1/12 3:29 AM, Kees Hink wrote:

> I'd like to register a viewlet for multiple dexterity content types, to
> cut down on the long list of registrations of the same viewlet for
> multiple types that i have in viewlets/configure.zcml. There's a lot of
> duplication there.
>
> With archetypes, i used to create a marker interface IHasViewlet and
> make my content types implement this interface in ZCML [1] like so:
>     <class class="path.to.class">
>       <implements
> interface=".interfaces.IHasViewlet" />
>     </class>
>
> But with dexterity types, i don't have a class to point to. I looked
> into plone.behavior’s marker support [2]. I ran into this problem:
>
> The viewlet should be enabled in our policy product, because it depends
> on different components. I'd like to keep the viewlet registration in
> one place (policy product). But it looks like the plone.behavior
> statement (primary marker behavior) should go into the respective
> content types' packages, right?
>
Your policy package can register the behavior and assign it to content
types. (Either by adding types/mytype.xml files in the policy profile
that only add a behavior without touching anything else, using
purge=False...or by writing a custom import handler that grabs the
relevant FTIs and adds the behaviors in Python.)

David


----------
David Glick
 Web Developer
 [hidden email]
 206.286.1235x32

Are you engaging? Find out! Use our free engagement benchmarking tool.

http://groundwire.org/labs/engagement-strategy/diy-benchmarking-survey



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
khink khink
Reply | Threaded
Open this post in threaded view
|

Re: registering a viewlet for multiple dexterity content types (from policy product)

Many thanks David. Like a charm.

On 06/01/2012 07:48 PM, David Glick wrote:

> On 6/1/12 3:29 AM, Kees Hink wrote:
>> I'd like to register a viewlet for multiple dexterity content types, to
>> cut down on the long list of registrations of the same viewlet for
>> multiple types that i have in viewlets/configure.zcml. There's a lot of
>> duplication there.
>>
>> With archetypes, i used to create a marker interface IHasViewlet and
>> make my content types implement this interface in ZCML [1] like so:
>>      <class class="path.to.class">
>>        <implements
>> interface=".interfaces.IHasViewlet" />
>>      </class>
>>
>> But with dexterity types, i don't have a class to point to. I looked
>> into plone.behavior’s marker support [2]. I ran into this problem:
>>
>> The viewlet should be enabled in our policy product, because it depends
>> on different components. I'd like to keep the viewlet registration in
>> one place (policy product). But it looks like the plone.behavior
>> statement (primary marker behavior) should go into the respective
>> content types' packages, right?
>>
> Your policy package can register the behavior and assign it to content
> types. (Either by adding types/mytype.xml files in the policy profile
> that only add a behavior without touching anything else, using
> purge=False...or by writing a custom import handler that grabs the
> relevant FTIs and adds the behaviors in Python.)
>
> David
>
>
> ----------
> David Glick
>   Web Developer
>   [hidden email]
>   206.286.1235x32
>
> Are you engaging? Find out! Use our free engagement benchmarking tool.
>
> http://groundwire.org/labs/engagement-strategy/diy-benchmarking-survey
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users