|
From: Michael F. <fuz...@vo...> - 2007-09-23 13:16:22
|
Sandro Dutra wrote:
> I've read all the documentation searching for this, and sure, I find on
> the item 15.1 this:
>
> 1. The only valid divider is '='.
> 2. ';' is no longer valid for comments, and no multiline comments.
>
> My problem is, I need my program to read and write on a ini format that
> uses ':' as divider and ';' as comment mark. So I want to know if the
> ConfigObj has no method to set those variables like:
>
> from configobj import ConfigObj
> config = ConfigObj()
> # Setting the divider and comment mark (example)
> config.divider = ":"
> config.comment = ";"
>
> If doesn't have it, please, how I can modify it? 'cause I really need to
> change it.
>
Hello Sandro,
As you have noticed, ConfigObj deliberately doesn't support these features.
You should be able to switch over the dividers and comment markers that
ConfigObj allows by changing the regular expressions it uses for parsing.
The regexes are class attributes of the ConfigObj class. Unfortunately
you probably need to modify all of them. This should be quite easy though.
There is also a line in the parser that detects lines that start with a
comment, line 1428:
if not sline or sline.startswith('#'):
As far as I can tell, that is all that needs to change.
All the best,
Michael Foord
http://www.manning.com/foord
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
>
>
|