[Grok-dev] how to read config from zope.conf
Christian Klinger
cklinger at novareto.de
Sun Nov 7 05:32:29 EST 2010
Hey Shrek,
i think the following steps are needed to read a custom configuration
form zope.conf...
1) You have to create your config at the end of the etc/zope.conf.ini file:
# Extra configuration lines can be added to zope_conf's extra option.
Put for
# instance productconf sections in here.
${zope_conf:extra}
<product-config database>
dbname oracle
</product-config>
2) run bin/buildout
3) To access theses configuration in your python module you can do the
following
from zope.app.appsetup.product import getProductConfiguration
config = getProductConfiguration('database')
dbname = config.get('dbname', 'default')
HTH Christian
More information about the Grok-dev
mailing list