[Product-Developers] How to override an adapter which is already overridden by CMFPlone ?

Wichert Akkerman wichert at wiggy.net
Mon Aug 25 20:23:01 UTC 2008


Previously Rafael Oliveira wrote:
> On Mon, Aug 25, 2008 at 3:14 PM, Wichert Akkerman <wichert at wiggy.net> wrote:
> > Previously Rafael Oliveira wrote:
> >>
> >> I have the following problem: I want to provide a custom
> >> implementation for the following adapter:
> >> [snipped]
> >>
> >> What am I doing wrong ?
> >
> > You can't override an override. Your only hope may be z3c.unconfigure:
> > http://pypi.python.org/pypi/z3c.unconfigure
> 
> I think I'm not understanding this aspect of the Zope Component Architecture.
> 
> Let's suppose I have an adapter called my_adapter, which belongs to a
> framework called framework_1. Then I write a new framework, called
> framework_2, built on top of framework_1. Then I write an application,
> built on top of framework_2. Shouldn't I be able to provide a custom
> implementation of my_adapter on framework_1 and my application ?
> 
> I'd appreciate if you help me to clarify this doubts.

It is similar to CSS !important rules: you can only override a rule once.
The fact that an override is needed is argueably a design mistake
somewhere.

> PS.: Besides z3c.unconfigure there's another hope: monkey patch :D

z3c.unconfigure can do things monkey patches can't. 

Wichert.

-- 
Wichert Akkerman <wichert at wiggy.net>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.




More information about the Product-Developers mailing list