Jim Fulton wrote at 2006-3-12 15:54 -0500: >Dieter Maurer wrote: >> Jim Fulton wrote at 2006-3-11 18:03 -0500: >> >>>... >>>Where is this documented? >> >> >> I do not know. I saw a feature description in the mailing list. >> Fred and Tres (the authors) should be able to tell you whether >> there is a formal documentation and where you can find it. >> >> >>>Let's pursue this a bit. >>> >>>Would it be possible to write a configuration file that loaded >>>it's own schemas? >> >> >> Yes -- with some restrictions: as I described in my previous mail. >> >> The feature essentially works as follows: >> >> You have an abstract section type in your primary >> schema, usually usable in a multisection. >> >> Examples: ZServer server, ZODB storage, the general extension >> abstract section type >> >> In your module/package, you define your own section type >> implementing the abstract section type in its "component.xml". >> You are completely free in its keys and subsections. >> >> In the configuration file, you import your module/package (which >> makes available the definitions in its "component.xml") and >> instantiate one or more of the section types defined there. >> >> Your application/module looks for the sections of "its" type >> and uses them. >> >> The restriction: you cannot have new keys on the top level -- all >> must be nested in a section type defined by your "component.xml". >> But, this, I consider an advantage (ZConfig here behave similar >> to a "ConfigParser" approach). > >So the example I gave won't work. In a schema, I have to have an >abstract type for each thing I might want to add. But I don't know what >I want to add. This doesn't sound very extensible.
You can have a *SINGLE* abstract type -- fixed for any extensions you may imagine and use this as the hook in your "component.xml". Such a single abstract type was added to the Zope schema to make almost arbitrary extensions possible. >I can't fathom the ZConfig documentation so I don't really know what >an abstract type is. It is essentially a name, which can be used at various places in your schema and implemented at other places in different ways. > I don't know how restrictive it has to be. >Can I define an abstract type that matched anything? Yes. I even think you currently cannot impose restrictions on the sectiontypes claiming to implement the abstract type. >Can I define a schema that just defines an abstract type that >matches anything? I think you must also use the abstract type in a section/multisection definition. But that would be all. -- Dieter _______________________________________________ Zope3-dev mailing list [email protected] Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
