|
From: Nicolas M. <nic...@le...> - 2011-06-20 15:16:45
|
Hello,
I have a problem understanding subsections with configobj.
Here is the structure of my config file :
[__main_section_1__]
key1 = string
key2 = string
key3 = string
[[__subsection_1__]]
sub_key_1 = string
sub_key_2 = string
(So there is an unlimited number of main section in which I have some
subsections ; at least one subsection by main section)
What I need to do is a loop on each subsection to do some job. I can't
do it (I'm new with Python so please excuse me if my question seems silly).
something like :
for subsections in main_section:
my_code
Here is a structure sample of my current config file :
ConfigObj({'opghl': {'acc_user': 'openerp', 'prod_user': 'openerp',
'acc_host': 'ghl-dev.lan.pcsol.be', 'db_prod': {'prod_db_name': 'ghl',
'acc_db_name': 'ghl'}, 'db_prod_2': {'prod_db_name': 'ghl2',
'acc_db_name': 'ghl2'}}, 'test': {'acc_user': 'openerp-test',
'prod_user': 'openerp-test', 'acc_host': 'test-dev.lan.pcsol.be',
'db_prod-test': {'prod_db_name': 'ghl-test', 'acc_db_name': 'ghl-test'},
'db_prod_2-test': {'prod_db_name': 'ghl2-test', 'acc_db_name':
'ghl2-test'}}})
==> I would want to list all the subsection of opghl or test. In that
case it would be
- for opghl : db_prod and db_prod_2
- for test : db_prod-test, db_prod_2-test
Thank you a lot for your help!
sylock
|