Issue1714
Created on 2007-12-31 15:30 by msuchy, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| cfgparser_doublequotes_r61014.patch | quentin.gallet-gilles, 2008-02-23 22:40 | |||
| Messages (6) | |||
|---|---|---|---|
| msg59060 - (view) | Author: Miroslav Suchy (msuchy) | Date: 2007-12-31 15:30 | |
I have some configuration params with leading space. And program
(getmail4) which use ConfigParser.py. ConfigParser strip all leading
(and trailing) spaces from values. This is very often the most wanted
result. But if I want value with leading space I have no option to put
it there.
Therefore I suggest to optionaly write string value as
key = "value"
This patch will solve it (it is against my OS, sorry no chance to
checkout svn).
--- /usr/lib/python2.4/ConfigParser.py.orig 2007-12-31
16:04:32.000000000 +0100
+++ /usr/lib/python2.4/ConfigParser.py 2007-12-31 16:06:50.000000000 +0100
@@ -472,6 +472,7 @@
if pos != -1 and optval[pos-1].isspace():
optval = optval[:pos]
optval = optval.strip()
+ optval = optval.strip('"')
# allow empty values
if optval == '""':
optval = ''
|
|||
| msg59777 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2008-01-12 02:44 | |
Please provide a patch against 2.6 with an unit test and documentation updates. |
|||
| msg60186 - (view) | Author: Quentin Gallet-Gilles (quentin.gallet-gilles) | Date: 2008-01-19 16:09 | |
Attached patch contain the added behavior, some unit tests to validate it and updated documentation. |
|||
| msg62826 - (view) | Author: Quentin Gallet-Gilles (quentin.gallet-gilles) | Date: 2008-02-23 22:40 | |
Here's an updated patch, taking in account akuchling and schmir suggestions. |
|||
| msg66582 - (view) | Author: Jonatas Oliveira (jonatasoliveira) | Date: 2008-05-10 20:17 | |
The cfgparser_doublequotes_r61014.patch works for me. I disagree wrapping a double quoted string with another double quote, it's more elegant using single quote like python's string behavior, but I don't know if is acceptable for a .ini file. PS: Like Jeremy Thurgood said in msg66523, this is almost the same of issue 1524825. |
|||
| msg66591 - (view) | Author: Jonatas Oliveira (jonatasoliveira) | Date: 2008-05-10 22:22 | |
Btw, i ran all tests before write "works for me" message. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:29 | admin | set | github: 46055 |
| 2010-07-10 05:41:57 | terry.reedy | set | status: open -> closed resolution: duplicate superseder: ConfigParser: accept leading whitespace on options+comments versions: + Python 3.2, - Python 2.6 |
| 2008-05-10 22:22:13 | jonatasoliveira | set | messages: + msg66591 |
| 2008-05-10 20:17:40 | jonatasoliveira | set | nosy:
+ jonatasoliveira messages: + msg66582 |
| 2008-03-25 16:14:00 | schmir | set | nosy: + schmir |
| 2008-03-25 14:54:08 | quentin.gallet-gilles | set | files: - cfgparser_doublequotes.patch |
| 2008-03-06 19:10:55 | draghuram | set | nosy: + draghuram |
| 2008-02-23 22:40:21 | quentin.gallet-gilles | set | files:
+ cfgparser_doublequotes_r61014.patch keywords: + patch messages: + msg62826 |
| 2008-02-23 20:42:22 | akuchling | set | assignee: akuchling nosy: + akuchling |
| 2008-01-19 16:09:00 | quentin.gallet-gilles | set | files:
+ cfgparser_doublequotes.patch nosy: + quentin.gallet-gilles messages: + msg60186 |
| 2008-01-12 02:44:38 | christian.heimes | set | components: + Library (Lib), - Extension Modules |
| 2008-01-12 02:44:25 | christian.heimes | set | priority: low keywords: + easy messages: + msg59777 nosy: + christian.heimes versions: + Python 2.6, - Python 2.4 |
| 2007-12-31 15:30:01 | msuchy | create | |
