Hi Stuart,

Stuart Bishop wrote:
What were the problematic bits?

# Disgusting hack to use our extended config file schema rather than the
# Z3 one. TODO: Add command line options or other to Z3 to enable overriding
# this -- StuartBishop 20050406
from zdaemon.zdoptions import ZDOptions
ZDOptions.schemafile = os.path.abspath(os.path.join(
        os.path.dirname(__file__), 'lib', 'canonical',
        'config', 'schema.xml'))

Also, there is only one schema.xml so multiple components can't each insert
their own blob of configuration information into the global schema.

Okay, so I can see two potential problems here:

1. Zope 3's schema.xml has the same problem that Zope 2's used to have - no generic multisection where other frameworks/products/whatever can insert their own bits of configuration. I suspect fixing that schema.xml (which involves inserting one or two lines ;-) would remove the need for your monkeypatch above.

2. Are you aware of the component.xml stuff that Dieter referred to?

We lost a fair bit of flexibility doing it this way. Field validation
to be done the ZConfig way.
How would you prefer to do it?

Validation of the entire config file, and if there are one or more errors
output a readable report at the end with error messages returned by the
validators. The current mechanism just spits out exceptions, which is really
bad for configuration files aimed at end users.

Agreed, this is something that could be added to ZConfig. Or Zope 3 could catch those exceptions and morph them into useful messages. Admittedly, you wouldn't get all the errors though, so ZConfig could do with some enhancement here...

If I have a non-required section foo, containing a non-required key bar, if
I try and access config.foo.bar I get an AttributeError. I should get the
default value for bar.

Okay, probably a bug. Have you reported this to the ZConfig author(s)?

My main gripe with the .ini format is the lack of hierarchy, but then I
worry that with XML we'll suffer from an overly complex schema...

Why would you want a schema for the XML?

xml freaks like schemas ;-)

Although I actually probably should have said "I worry that we'll end up with overly complex and badly structured xml *cough*zcml*cough*...

  - validation handlers would be registered for a particular XML namespace

...yay! we love namespaces *sigh*

  - Config file is loaded into a set of data structures, one for
    each XML namespace

That's not a bad idea though...

  - warnings are emitted if there are XML namespaces loaded that don't have
    a validator.

Why? If people don't want validators, don't force them...

Of course, .ini would be able to emit more meaningfull error messages:
foo/bar/1 in section [whatever] is required, but not found
blah/whatever in section [whatever] is not a valid url
section [baz] is required but does not exist.

I'm all for just fixing the bugs in ZConfig and I think you'll be happy enough. Not sure it's worth the huge upheavels :-S



Simplistix - Content Management, Zope & Python Consulting
           - http://www.simplistix.co.uk

Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to