473,480 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Comments in configuration files

Bonjour,

I am developing an application and I have a configuration file with a
lot of comments to help the application users understand what the
options mean

I would like it to be editable, through a web browser or a GUI
application. With ConfigParser I can read the configuration file and
edit the options, but when I write the result all the comments are lost

Are there modules that work on the same kind of ini files (for the needs
of my application, I prefer this format to XML or YAML) and don't remove
the comments ?

TIA,
Pierre
Jul 18 '05 #1
1 1539
Pierre Quentel wrote:
Bonjour,

I am developing an application and I have a configuration file with a
lot of comments to help the application users understand what the
options mean

I would like it to be editable, through a web browser or a GUI
application. With ConfigParser I can read the configuration file and
edit the options, but when I write the result all the comments are lost

Are there modules that work on the same kind of ini files (for the needs
of my application, I prefer this format to XML or YAML) and don't remove
the comments ?

TIA,
Pierre

The latest incarnation of 'tconfpy' I just released will get you close:

http://www.tundraware.com/Software/tconfpy

This program can read a configuration either from memory (a list) or a file.
So you could:

1) Read the file into an in-memory list (including the comments).

2) Pass the list to the parser, which would return a populated symbol
table.

3) Use your application to read the current values of the symbols from
the symbol table.

4) Modify the values in the symbol table as desired.

5) Map the new values in the symbol table back into the original list where
the values were set intitially (this is the part that would take some work).

6) Write the list back to disk.

Note that the semantics of feature of 'tconfpy' are substantially different
than 'ConfigParser', and the languages recognized by each are quite different
as well. It is probably fair to say that 'tconfpy' recognizes a superset
of the language recognized by 'ConfigParser'. But you have to be
careful because the semantics are somewhat different.

--
----------------------------------------------------------------------------
Tim Daneliuk tu****@tundraware.com
PGP Key: http://www.tundraware.com/PGP/
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
290
by: suzy | last post by:
Hi, I am wondering why my comments do not appear in intellisense. I have written the following method: /// <summary> /// testing /// </summary> /// <param name="stem">will this...
1
2895
by: TT (Tom Tempelaere) | last post by:
Hey everyone, I'm currently writing software for a project that uses a lot of Xml files for configuration. The project is written in C#/.NET. Each such xml file has a schema defined for it (Xsd...
5
2260
by: rdcpro | last post by:
In reading MSDN docs on creating custom Configuration sections, I found this page: ...
5
2565
by: NoNickname | last post by:
Basically, how do I know that the release versions of all components are being published? The Build | Configuration Manager is confusing me a little in VS2005. I have three projects in my...
2
33093
by: Jessy Martin | last post by:
what is the syntax for comments in the XML file? I have app.config and would like to write comments for each key value. <?xml version="1.0" encoding="utf-8" ?> <configuration> ...
5
1279
by: Carl J. Van Arsdall | last post by:
Hey everyone, another question for the list. In particular i'm looking for comments on some of the distributed technologies supported in python. Specifically, I'm looking at XML-RPC, RPyC, CORBA,...
7
10308
by: Peter Bradley | last post by:
OK. A bit behind the times, I know; but we're just moving over to .NET 2.0. How on earth do you manage configuration settings in a class library in .NET 2.0? In version 1.1, we used a handy class...
9
2346
by: Antonio Ooi | last post by:
Hi, I have the following appSettings in my app.config file: <appSettings> <!-- Some comments here --> <add key="MyKey1" value="1"/>
0
2598
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi, thanks, mister The code string rutaConfig = tbRutaConfigServicioBase.Text; '// Map to the application configuration file. ExeConfigurationFileMap configFile = New...
0
7054
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7097
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6750
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4794
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4493
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3003
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2993
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
567
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.