473,545 Members | 2,788 Online
Bytes | Software Development & Data Engineering Community
+ 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 1546
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****@tundrawa re.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 work?</param>
1
2899
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 file). This schema is not used at run-time. What we do is use XPath expressions to query for required information (nodes). We are currently still...
5
2266
by: rdcpro | last post by:
In reading MSDN docs on creating custom Configuration sections, I found this page: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfcustomelementfornamevaluesectionhandlerdictionarysectionhandler.asp At the very bottom, it says: Configuration File This element can be used in the application...
5
2571
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 solution: 1) web service website. 2) SOAP Extension Class Lib that compiles to a dll 3) WinForm application with a proxy to test the web service.
2
33135
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> <appSettings>
5
1288
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, and Twisted. Before you offer any comments let me talk about what i'm doing a little bit. Right now I'm creating an execution framework. The...
7
10312
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 called AssemblySettings that someone (I forget his name) had written. When the class library was finished, you deployed it to the GAC and put the...
9
2354
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
2610
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 ExeConfigurationFileMap();
0
7499
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7689
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7943
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5359
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5076
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1919
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
743
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.