|
From: Mohanaraj G. K. <mo...@gm...> - 2010-03-29 12:43:23
|
Hi guys,
I have been trying to come up with a config file that look as follows
--
log_dir = '/var/log'
oltp_host = localhost
olap_host = $oltp_host
[app]
log_dir = ${log_dir}/app
oltp_host = $oltp_host
olap_host = $olap_host
--
And access it with the following trivial code:
--
import configobj
from configobj import ConfigObj
configobj.DEFAULT_INTERPOLATION ='Template'
a = ConfigObj('./config.ini')
print a
--
However when i try to access it with the following code I get
"configobj.InterpolationLoopError: interpolation loop detected in value
"log_dir". "
Looking at the code it seems to be because of the common names. I have
implemented a naive hack that will allow for params to have the same names
as their values, by ensuring that they don't end up referencing to
themselves. I realise that this is not a complete fix and there are still
cases where this will break down, but I would just like to know what you
guys think ? I have attached the patch to this email.
Thanks
--
Mohanaraj
|