This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lukasz.langa
Recipients Kunjesh.Kaushik, fdrake, lukasz.langa, r.david.murray, rhettinger
Date 2011-01-28.10:30:27
SpamBayes Score 1.9707325e-10
Marked as misclassified No
Message-id <1296210628.79.0.780436757768.issue11027@psf.upfronthosting.co.za>
In-reply-to
Content
Kunjesh, first of all many thanks for your feedback! A bit of advice, though. I have myself made the mistake of calling features I personally want as "often needed". The reality is that they are not often needed if they weren't reported before. While the current behaviour is not intuitive and probably unwelcome, it's hardly a bug if it has been that way for 15 years now.

At one point I had `sectionxform` implemented for configparser 3.2 but it made the source less readable. Then I thought about what Raymond taught me: is this a feature that follows a real use case? I concluded it didn't so I left it out. That being said, your report proves that such functionality would be welcome. I checked and ConfigObj does strip whitespace from section names, too. Nevertheless, in my opinion that's a feature request that only applies to Python 3.3. Your patches are for 2.7.

Let me elaborate a bit on a broader issue: configparser as of 3.2 still has only limited ability to write configuration files back (it strips whitespace and comments between options, option names get xformed). I want to fix that for 3.3 so the file can be altered and written back with only minimal changes. `optionxform` already gets in the way, `sectionxform` would too, if improperly implemented.

Raymond, I would want to keep the regexes as raw as possible as to enable writing the file back with the whitespace preserved. That includes whitespace around the section name, if we are to support that.

To conclude: I won't touch the regexes, I will implement `sectionxform` while implementing on-save whitespace and comment preservation for 3.3.
History
Date User Action Args
2011-01-28 10:30:28lukasz.langasetrecipients: + lukasz.langa, fdrake, rhettinger, r.david.murray, Kunjesh.Kaushik
2011-01-28 10:30:28lukasz.langasetmessageid: <1296210628.79.0.780436757768.issue11027@psf.upfronthosting.co.za>
2011-01-28 10:30:28lukasz.langalinkissue11027 messages
2011-01-28 10:30:27lukasz.langacreate