Multiple schema extensions on the same type

3 Messages Forum Options Options
Embed this topic
Permalink
Hedley Roos
Multiple schema extensions on the same type
Reply Threaded MoreMore options
Print post
Permalink
Hi all

Is it possible to extend say Document with both FooExtender and
BarExtender using schema extender?

The respective zcml is then
<adapter factory=".foo.FooExtender"/> and
<adapter factory=".bar.BarExtender"/>

Both classes do "adapts(Document)".

I find that only one extender wins in this case. Is there a smart way to
register the adapters or should I change BarExtender to adapt
FooExtender instead of Document?

In case you're wondering the one extension is coded by someone else, so
I can't roll them into one module.

Thanks
Hedley

_______________________________________________
Product-Developers mailing list
Product-Developers@...
http://lists.plone.org/mailman/listinfo/product-developers
David Glick-2
Re: Multiple schema extensions on the same type
Reply Threaded MoreMore options
Print post
Permalink

On Aug 7, 2008, at 4:53 AM, Hedley Roos wrote:

> Hi all
>
> Is it possible to extend say Document with both FooExtender and
> BarExtender using schema extender?
>
> The respective zcml is then
> <adapter factory=".foo.FooExtender"/> and
> <adapter factory=".bar.BarExtender"/>
>
> Both classes do "adapts(Document)".
>
> I find that only one extender wins in this case. Is there a smart  
> way to
> register the adapters or should I change BarExtender to adapt
> FooExtender instead of Document?

Yes, just make sure you register the extenders as *named* adapters  
with different names.  (e.g. <adapter factory=".foo.FooExtender"  
name="foo"/>)

David Glick
Project Associate
ONE/Northwest

New tools and strategies for engaging people in protecting the  
environment

http://www.onenw.org
davidglick@...
(206) 286-1235 x32

Subscribe to ONEList, our email newsletter!
Practical advice for effective online engagement
http://www.onenw.org/full_signup




_______________________________________________
Product-Developers mailing list
Product-Developers@...
http://lists.plone.org/mailman/listinfo/product-developers
Hedley Roos-2
Re: Multiple schema extensions on the same type
Reply Threaded MoreMore options
Print post
Permalink
> Yes, just make sure you register the extenders as *named* adapters with
> different names.  (e.g. <adapter factory=".foo.FooExtender" name="foo"/>)
>

Thanks! Works perfectly.

Hedley

_______________________________________________
Product-Developers mailing list
Product-Developers@...
http://lists.plone.org/mailman/listinfo/product-developers