AW: [Zope3-dev] override metadirectives before use them not afterwards

Roger ineichen dev at projekt01.ch
Fri Apr 23 20:11:07 EDT 2004


Fred Drake wrote:
> Gesendet: Freitag, 23. April 2004 23:08
> An: r.ineichen at projekt01.ch; zope3-dev at zope.org
> Betreff: Re: [Zope3-dev] override metadirectives before use 
> them not afterwards
> 
> 
> On Friday 23 April 2004 08:03 am, Roger Ineichen wrote:
>  > I think yes, but it's not implemented right now,
>  > because the ZConfig registers all directives and in the action
> 
> I don't know the answer to your question, but I will point 
> out that ZConfig 
> and ZCML aren't related.  We're using ZConfig for end-user 
> configuration 
> tasks, but not for the layer ZCML is designed to serve.

Thanks for answering,
I think it's a conceptual question how the overrides.zcml work.

I think ZCML serves to much a this time. (eg. contents.pt)
and there are too much hardcoded classes and templates around.


Let's explain a litle bit more;

First directive in configure.zcml:
---------------
<browser:containerViews
    for="zope3samples.base.interfaces.IZope3SampleContainer"
    contents="zope.ManageContent"
    index="zope.View"
    add="zope.ManageContent"
    />

Original meta directive in meta.zcml:
-----------------------
<meta:directives namespace="http://namespaces.zope.org/browser">
<meta:directive
    name="containerViews"
    schema=".metaconfigure.IContainerViews"
    handler=".metaconfigure.containerViews"
    />
</meta:directives>

Overriden meta directive in overrides.zcml:
------------------------
You also can override a metaconfigure directive like:

<meta:directives namespace="http://namespaces.zope.org/browser">
<meta:directive
    name="containerViews"
    schema="zope.app.container.browser.metaconfigure.IContainerViews"
    handler="tiks.base.container.browser.metaconfigure.containerViews"
    />
</meta:directives> 

What's happen now is:

First, the first directive gets registred as a action (callable) .
Second, the (override) meta directive "containerViews" will replace
the original meta directive.

What's happen now is, we have a new overriden meta directive
containerViews which is useing the class  
tiks.base.container.browser.metaconfigure.containerViews as 
the handler.

Till here it's ok, all above  works fine. You can 
override meta directives. But they are not used.

What's exatly should happen is:
The second directive affects the first directive "indirectly".
And the first directive should be replaced.
This isn't implemented. And this means we can (yes, this means we can)
override meta directive but they are ignore affected directives and
register the old handler's.

I think this is a real restriction and means you have to use
all the directives of the zope namespace with all the implemetation
behinde them. I whould like to override some implementations
of the zope namespace. Or exactly the page template which such 
classes import ;-( 

See the contents.pt and intdex.pt templates in 
zope.app.container.browser.contents.Contents

If there is no way for to support override meta directives,
you will see some kind of monky patch like in Zope2 for
to replace just templates like contents.pt ;-( wuaaa.

This means also, there is no other way for to replace some
parts of the Zope3 application server. Not exactly correct,
I can write a own zope.app.container package with exactly
the same package name and replace them with the original.
I don't hope to see anybody develope this way in the future
just for to replace a contents.pt template for the zmi skin.

Is there a way to solve this problem?

Regards
Roger



> 
>   -Fred
> 
> -- 
> Fred L. Drake, Jr.  <fred at zope.com>
> PythonLabs at Zope Corporation
> 
> 
> _______________________________________________
> Zope3-dev mailing list
> Zope3-dev at zope.org http://mail.zope.org/mailman/listinfo/zope3-dev
> 




More information about the Zope3-dev mailing list