[Grok-dev] how to read config from zope.conf

Christian Klinger cklinger at novareto.de
Wed Nov 10 04:24:43 EST 2010


Am 09.11.10 23:14, schrieb Martijn Faassen:
> Hey,
>
> On 11/07/2010 11:32 AM, Christian Klinger wrote:
>> 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')
>
> This would work well as a howto somewhere, perhaps in our new community
> documentation. :)
>
He Martijn,

will do.

Christian


> Regards,
>
> Martijn




More information about the Grok-dev mailing list