|
From: Michael F. <fuz...@vo...> - 2010-04-04 21:42:56
|
On 02/04/2010 00:50, Chris Jones wrote:
> Hey
>
> Is it possible to disable inline comments (for both reading and writing
> configs)? I have no particular desire to support them in my config
> files, but I would like to be able to have html style colour codes
> without quoting.
>
> Cheers,
>
Hi Chris,
Well if you use '_inspec=True' in the constructor it switches off inline
comment parsing - but that is for parsing configspecs and I wouldn't
necessarily guarantee to support it forever in the future...
>>> import configobj
>>> c = configobj.ConfigObj(['foo = hello # bar'], _inspec=True)
>>> c
ConfigObj({'foo': 'hello # bar'})
All the best,
Michael Foord
--
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.
|