[Zope-dev] [ZConfig] "import" inhomogenous

Dieter Maurer dieter at handshake.de
Thu Feb 19 14:09:23 EST 2004


Fred Drake wrote at 2004-2-18 15:01 -0500:
> ... importing schemas ...
[DM]
> > A use case is the import of the section types
> > defined in "Zope.Startup.zopeschema.xml" for
> > other ZEO applications that require access to the
> > same ZODB database(s). It is far more
> > convenient to access this schema via "package"+"file"
> > than an URL.

[FD]
>Is there some reason not to simply move the section types to a schema 
>component?  That seems more in the spirit of making the schema modular.

This would be an alternative.

However, the change is much bigger (measured in patch size)
than my ZConfig patch.

> ...
>I've not read the patch yet, so I'll ask:  what's the point of the "type" 
>attribute?

I propose to make the type of the imported object orthogonal
to the location where the object comes from. This means, you
have the following options

  *  schema component from package

  *  schema component from url

  *  schema from package

  *  schema from url

The "type" attribute specifies whether you want to import
a "schema component" or a "schema".
You could do without this attribute when we would look into
the resource and determine from the content what it is.


> Should it be an error if the type doesn't match the top-level 
>element of the resource?  If only advisory, is it actually useful?

Currently, a wrong type lead to a "ConfigurationError".


>Thanks for thinking critically about ZConfig.

I am using it and see places where I am forced to either
make significant changes or have significant code (either
schema or configuration) duplications. I hate code duplications...

This time I use it to automate processing Shane's QueueCatalog's.
The corresponding script needs the same ZODB configuration
as Zope (a complex DBTab configuration with potentially many
storages). Therefore, its schema needs the "zodb_db" definition
defined in Zope's schema.


It is quite nice to use ZConfig. Thank you for this tool.

-- 
Dieter



More information about the Zope-Dev mailing list