How to add sections to zope.conf?
Hi all, Say I have a process which needs some configuration but which is based on zope. How do I add arbitary sections into zope.conf at the top level and then how do I get hold of the configuration? What I'd like to do (and tried!) is to write a component.xml, put it in my package and then add a section to the top-level of my zope.conf something like: %import mypackage <mypackage_config> somekey somevalue </mypackage_config> ...and then get hold of it with: from App.config import getConfiguration config = getConfiguration().mypackage_config ...but this doesn't seem to work. Am I doing something wrong or do their need to be changes to zopeschema.xml to allow this? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Chris Withers wrote at 2004-7-4 09:19 +0100:
Say I have a process which needs some configuration but which is based on zope. How do I add arbitary sections into zope.conf at the top level and then how do I get hold of the configuration?
What I'd like to do (and tried!) is to write a component.xml, put it in my package and then add a section to the top-level of my zope.conf something like:
%import mypackage <mypackage_config> somekey somevalue </mypackage_config>
...and then get hold of it with:
from App.config import getConfiguration config = getConfiguration().mypackage_config
...but this doesn't seem to work. Am I doing something wrong or do their need to be changes to zopeschema.xml to allow this?
You must extend the "zopeschema.xml" or let your process use a schema derived from "zopeschema.xml" (schema support some form of inheritance). -- Dieter
Dieter Maurer wrote:
You must extend the "zopeschema.xml" or let your process use a schema derived from "zopeschema.xml" (schema support some form of inheritance).
Is there any way for a Product to do this or do I actually have to go and manually spank zopeschema.xml when I install my product? Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Chris Withers wrote at 2004-7-16 08:52 +0100:
Dieter Maurer wrote:
You must extend the "zopeschema.xml" or let your process use a schema derived from "zopeschema.xml" (schema support some form of inheritance).
Is there any way for a Product to do this or do I actually have to go and manually spank zopeschema.xml when I install my product?
Hm: was the sentence not clear? Yes, you either must change "zopeschema.xml" or use a different one (which may inherit from "zopeschema.xml"). There is also a way for the class interpreting the schema to add configuration options not present in the schema. See the "add" method in "zdaemon.zdoptions.ZDOptions". Zope currently does not provide a registration facility to use this way by products. Of course, you can change the code... -- Dieter
participants (2)
-
Chris Withers -
Dieter Maurer