|
From: Mohanaraj G. K. <mo...@gm...> - 2010-03-29 12:43:23
Attachments:
self_referential_vars.patch
|
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
|
|
From: Michael F. <fuz...@vo...> - 2010-03-30 14:09:28
|
Hi Mohanaraj,
Do the tests still pass with your patch applied? For a patch to be
considered it should include tests for the new behavior and preferably a
docs patch as well. :-)
All the best,
Michael Foord
On 29/03/2010 13:18, Mohanaraj Gopala Krishnan wrote:
> 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
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
>
>
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
--
http://www.ironpythoninaction.com/
|
|
From: Mohanaraj G. K. <mo...@gm...> - 2010-03-31 01:04:49
|
Is there someplace I can refer to get an idea as to how to run the tests. I
have done
cd configobj-4.7.2/tests
python test_configobj.py
and get the follwing result
3 items had failures:
2 of 7 in configobj.Section.as_int
1 of 6 in configobj.Section.merge
2 of 6 in configobj.Section.walk
***Test Failed*** 5 failures.
However I get these same results when I try to run the tests before applying
my patch.
Any advice ?
Mohan
On Tue, Mar 30, 2010 at 10:09 PM, Michael Foord
<fuz...@vo...>wrote:
> Hi Mohanaraj,
>
> Do the tests still pass with your patch applied? For a patch to be
> considered it should include tests for the new behavior and preferably a
> docs patch as well. :-)
>
> All the best,
>
> Michael Foord
>
>
> On 29/03/2010 13:18, Mohanaraj Gopala Krishnan wrote:
>
> 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
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.http://p.sf.net/sfu/intel-sw-dev
>
>
> _______________________________________________
> Configobj-develop mailing lis...@li...://lists.sourceforge.net/lists/listinfo/configobj-develop
>
>
>
> -- http://www.ironpythoninaction.com/
>
>
--
Mohanaraj
http://mohangk.org/blog
|
|
From: Michael F. <fuz...@vo...> - 2010-03-31 12:38:24
|
On 31/03/2010 02:04, Mohanaraj Gopala Krishnan wrote:
> Is there someplace I can refer to get an idea as to how to run the
> tests. I have done
>
> cd configobj-4.7.2/tests
> python test_configobj.py
>
That runs most of the tests. There are some unit tests as well. I use
unittest2 test discovery (the discover module should work as well - both
are on PyPI) to run these.
> and get the follwing result
>
> 3 items had failures:
> 2 of 7 in configobj.Section.as_int
> 1 of 6 in configobj.Section.merge
> 2 of 6 in configobj.Section.walk
> ***Test Failed*** 5 failures.
>
> However I get these same results when I try to run the tests before
> applying my patch.
>
> Any advice ?
>
Hmm... What version of Python are you using and what operating system?
Can you show the actual test failures (the results), thanks.
Michael
> Mohan
>
>
>
> On Tue, Mar 30, 2010 at 10:09 PM, Michael Foord
> <fuz...@vo... <mailto:fuz...@vo...>> wrote:
>
> Hi Mohanaraj,
>
> Do the tests still pass with your patch applied? For a patch to be
> considered it should include tests for the new behavior and
> preferably a docs patch as well. :-)
>
> All the best,
>
> Michael Foord
>
>
> On 29/03/2010 13:18, Mohanaraj Gopala Krishnan wrote:
>> 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
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>>
>>
>> _______________________________________________
>> Configobj-develop mailing list
>> Con...@li... <mailto:Con...@li...>
>> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>>
>
>
> --
> http://www.ironpythoninaction.com/
>
>
>
>
> --
>
> Mohanaraj
> http://mohangk.org/blog
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.
|
|
From: Mohanaraj G. K. <mo...@gm...> - 2010-04-01 01:04:42
Attachments:
test_output.txt
|
On Wed, Mar 31, 2010 at 8:19 PM, Michael Foord <fuz...@vo...> wrote: > > On 31/03/2010 02:04, Mohanaraj Gopala Krishnan wrote: > > Is there someplace I can refer to get an idea as to how to run the tests. I have done > cd configobj-4.7.2/tests > python test_configobj.py > > That runs most of the tests. There are some unit tests as well. I use unittest2 test discovery (the discover module should work as well - both are on PyPI) to run these. Ok I will try those modules out thanks! > > and get the follwing result > 3 items had failures: > 2 of 7 in configobj.Section.as_int > 1 of 6 in configobj.Section.merge > 2 of 6 in configobj.Section.walk > ***Test Failed*** 5 failures. > However I get these same results when I try to run the tests before applying my patch. > Any advice ? > > Hmm... What version of Python are you using and what operating system? Can you show the actual test failures (the results), thanks. I use Ubuntu 9.10, python version 2.6.4 , from the distributions repository. I have attached the complete test results, when I run "python test_configobj.py". <snip> |
|
From: Michael F. <fuz...@vo...> - 2010-04-04 21:33:18
|
On 01/04/2010 02:04, Mohanaraj Gopala Krishnan wrote:
> [snip...]
>> and get the follwing result
>> 3 items had failures:
>> 2 of 7 in configobj.Section.as_int
>> 1 of 6 in configobj.Section.merge
>> 2 of 6 in configobj.Section.walk
>> ***Test Failed*** 5 failures.
>> However I get these same results when I try to run the tests before applying my patch.
>> Any advice ?
>>
>> Hmm... What version of Python are you using and what operating system? Can you show the actual test failures (the results), thanks.
>>
> I use Ubuntu 9.10, python version 2.6.4 , from the distributions repository.
> I have attached the complete test results, when I run "python
> test_configobj.py".
>
The test failures you posted make me think you aren't running the tests
against the most recent version of ConfigObj. For example:
'ConfigObj' object has no attribute 'as_list'
If I try this:
>>> import configobj
>>> configobj.__version__
'4.7.2'
>>> c = configobj.ConfigObj()
>>> c.as_list
<bound method ConfigObj.as_list of ConfigObj({})>
All the best,
Michael
> <snip>
>
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
>
>
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.
|