Message39706
Logged In: YES
user_id=7887
Thanks for purposing that Detlef. Having a configuration file without
headers could indeed be interesting in some situations.
I have a few comments about the implementation:
The patch includes a new parameter in read functions, stating
what's the first section name. It means that we could have other
sections after the first unheaded section. IMO, that situation should
still be considered an error.
One possible way to implement it is to include a "noheaders" boolean
parameter for the constructor. Then, the user would have to know what's
the standard single section name, to pass it to functions like get().
Another way would be to include something like a "singlesection" parameter
in the constructor. This parameter would accept a string option, which
would name the single section.
As an argument against the whole issue, I'm not sure how unconfortable
it is to simply include a header in the file to satisfy the parser.
As an argument favorable, this could allow ConfigParser to parse simple
(no escapes or variables) shell configuration files and other simple
configurations using NAME=VALUE style.
I'm attaching an alternative implementation of the singlesection algorithm,
described above. Would it be enough for your needs?
|
|
Date |
User |
Action |
Args |
2007-08-23 15:12:29 | admin | link | issue549037 messages |
2007-08-23 15:12:29 | admin | create | |
|