[Zconfig] Write support

Chris McDonough chrism at plope.com
Fri Dec 3 15:27:20 EST 2004


On Fri, 2004-12-03 at 15:01, Andy McKay wrote:
> > I've got the million dollar question: how should I go implementing write 
> > support in ZConfig? Tried to look at the code, but it's a bit long to follow. 
> > Googling around I found other people interested in such a feature, but no 
> > code whatsoever.
> 
> No idea :)

I think it probably has something to do with reading and writing some
Python. ;-)  But maybe Fred can give an idea about how he'd think about
going about it.

> I'm currently mangling the file using string expressions. I chatted to 
> Chris M who had some idea about it. I was suggesting just throwing 
> ZConfig out and replacing it with XML that is read in by Zope for a 
> billion reasons ;)

ZConfig isn't a file format, FWIW.

The file format itself doesn't have much to do with the actual purpose
of ZConfig.  It would be easy to replace the Apache parser in ZConfig
with an XML parser, and have an XML config file.  That could probably be
done in a day and ZConfig could still be used to read the file.

But it still wouldn't solve the problem of needing to know if a value
for an element given in the config file is valid.  ZConfig's main job in
life is to allow you to describe and extend a schema for a configuration
and to enforce the schema at config file parsing time, stopping with a
sensible error message if a value in the config makes no sense according
to the schema.

XML Schema gives you some of this but doing schema validation by writing
regular expressions inside of XML is painful (I'm using it now for
another project, FWIW).  I'm not sure whether there are other
Python-based schema validation tools out there.

What would you do if you did have an XML configuration file to do schema
checking?

>  Chris M was trying to get me back on the ZConfig kool 
> aid :)

FWIW, I think adding write support to ZConfig would be better than
starting from scratch with a new schema system.

> > When all fails, I could just loop on sections in a config object and write 
> > something ad hoc "from the outside", but maybe there's a better, and not too 
> > long way?
> 
> I'm not even going to commit to anything, but I need to solve the same 
> thing as well and would like to move beyond the hacks we have.

I can't commit either but I express noodling interest in same.

- C




More information about the ZConfig mailing list