473,569 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ConfigParser: whitespace leading comment lines

Hello all,
I'd like to propose the following change to ConfigParser.py .
I won't call it a bug-fix because I don't know the relevant standards.
This change will enable multiline comments as follows:

[section]
item=value ;first of multiline comment
;second of multiline comment

Right now the behaviour is

In [19]: cfg.get('sectio n','item')
Out[19]: 'value\n;second of multiline comment'

It's a one-line change.
RawConfigParser ._read lines 434-437
# comment or blank line?
- if line.strip() == '' or line[0] in '#;':
+ if line.strip() == '' or line.strip()[0] in '#;':
continue

Regards,
Greg Willden

Oct 12 '06 #1
1 2312
*************** ********
Your mail has been scanned by InterScan MSS.
*************** ********
On Friday 13 October 2006 04:13, gw******@gmail. com wrote:
I'd like to propose the following change to ConfigParser.py .
IMO there's a reason that left it in such way.
Whom didn't like the ConfigParser classes had made a new module, and I could
find a the least 4 of them (cfgparse, config, configobj, pytconfpy).
I choose ConfigParser because I'm very new and I haven't learn how to
implement subclasses.
I also will to use ConfigParser with some more feature like sub-options, but I
didn't get that clue :(
If you don't like that behavior easy you can override it in a subclass and use
the way you prefer.

F

Oct 13 '06 #2

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

Similar topics

3
4035
by: Josh Close | last post by:
I'm using ConfigParser and I can't seem to get a config option to span more than one line. var = blah blah blah\ blah continued Putting the '\' doesn't work Is there a way to do that? Or do I have to deal with having a huge
2
1691
by: rzed | last post by:
I am working with PythonCard in one of my apps. For its purposes, it uses an .ini file that is passed to ConfigParser. For my app, I also need configuration information, but for various reasons, I'd rather use a syntax that ConfigParser can't handle. I know I can maintain two separate configuration files, and if I have to I will, but I'd...
16
2282
by: qwweeeit | last post by:
In analysing a very big application (pysol) made of almost 100 sources, I had the need to remove comments. Removing the comments which take all the line is straightforward... Instead for the embedded comments I used the tokenize module. To my surprise the analysed output is different from the input (the last tuple element should exactly...
0
1224
by: marfi95 | last post by:
I have an xml file that I want to maintain the whitespace on and spacing between my sections. I have something like this. <!-- Comment lines A --> <!-- Comment lines A --> <A> <B>test</B> <B>test1</B> <B>test2</B> </A>
56
3522
by: infidel | last post by:
Where are they-who-hate-us-for-our-whitespace? Are "they" really that stupid/petty? Are "they" really out there at all? "They" almost sound like a mythical caste of tasteless heathens that "we" have invented. It just sounds like so much trivial nitpickery that it's hard to believe it's as common as we've come to believe.
4
6043
by: Steve Richter | last post by:
when I run the following code the leading spaces of the "data" node are removed. How do I retain whitespace? private void CreateBasicXmlDocument() { XmlWriterSettings writeSettings = new XmlWriterSettings(); writeSettings.Indent = true; XmlWriter writer = XmlWriter.Create( filePath, writeSettings );
4
3977
by: Joel Andres Granados | last post by:
Hi list: I have run across a situation with ConfigParser Module. It refers to the comments in the configuration filed. According to the http://docs.python.org/dev/lib/module-ConfigParser.html it states that lines starting with "#" and ";" are ignored. So lines like: ; comment # comment are considered comments. So far so good.
4
14153
by: Phoe6 | last post by:
Hi, I have a configfile, in fact, I am providing a configfile in the format: Name: Foo Author: Bar Testcases: tct123
3
2834
by: Phoe6 | last post by:
Hi, Am starting a new thread as I fear the old thread which more than a week old can go unnoticed. Sorry for the multiple mails. I took the approach of Subclassing ConfigParser to support multiline values without leading white-spaces, but am struct at which position in _read I should modify to accomodate the non-leading whitespace based...
0
7703
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
8138
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
7679
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
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
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
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
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
946
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.