[Zope3-dev] Extending a top-level ZConfig schema

Phillip J. Eby pje@telecommunity.com
Thu, 10 Jul 2003 11:22:18 -0400


At 10:17 AM 7/10/03 -0400, Fred L. Drake, Jr. wrote:

>Phillip J. Eby writes:
>  > There doesn't seem to be any way to extend a top-level ZConfig schema (as
>  > opposed to a schema component); are there any plans to change that?
>
>I'm not sure which of two different things you're trying to do:
>
>- modify the top level of a schema from something it <import/>s, or
>
>- create a new schema that adds to an existing schema.

The latter.

>If what you want is the later, I could see adding support for it using
>syntax like this:
>
><schema extends='src'>
>   <!-- only the new stuff here -->
></schema>
>
>where src is similar to the src attribute of <import/>, but
>everything is retained (essentially doing the same thing as <import
>src='...'/> plus a <sectiontype extends='that-other-schema'/>).

Would you suggest that attributes of src's "schema" tag be applied as 
defaults to the extending schema, or only the contents?

Also, while I don't need it at the moment, how would one extend/merge 
multiple schemas with an extends="" attribute?


>  > I thought that using <import src=""> would do it, but that only seems to
>  > import section *types*, not key or section definitions.
>
>That's correct.  This was done this way since so the difference
>between <import src='...'/> and <import package='...'/> wasn't too
>confusing.

Perhaps we could use an <extend src=""> or <include src=""> tag instead, then.

I assumed that <import src=""> would work because I was importing a 
*schema*, rather than a schema *component*.  In other words, I thought the 
behavior would be based on the contents of what I imported.