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.
Created on 2006年07月18日 21:17 by kenlalonde, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| patch.txt | kenlalonde, 2006年07月18日 21:17 | Patch to ConfigParser.py, current SVN | ||
| cfgparser_comments.patch | quentin.gallet-gilles, 2008年03月25日 13:59 | Patch against trunk (r61890) | ||
| Messages (10) | |||
|---|---|---|---|
| msg50719 - (view) | Author: Ken Lalonde (kenlalonde) | Date: 2006年07月18日 21:17 | |
ConfigParser considers leading white space before options and comments to be syntax errors, which is a bit harsh, and limits the utility of the module when parsing files originally written for other programs, such as Samba's smb.conf. The attached patch ignores leading white space on options, and skips comments with leading w.s. |
|||
| msg50720 - (view) | Author: Chad Whitacre (whit537) | Date: 2006年07月31日 20:53 | |
Logged In: YES user_id=340931 Thanks for the patch Ken! This change sounds reasonable and low-risk. However, some patch suggestions: 1. Diff against HEAD of trunk/ from svn, not your platform's python installation 2. Add some tests in Lib/test/test_cfgparser.py (this will be in a source distribution from svn, but not in your platform's binary distribution) 3. Update the doc in Doc/lib/libcfgparser.tex (again, this will be in a source dist) FWIW, these are mentioned in the (admittedly somewhat obtuse) patch guidelines: http://www.python.org/dev/patches/ |
|||
| msg62856 - (view) | Author: Quentin Gallet-Gilles (quentin.gallet-gilles) | Date: 2008年02月24日 00:36 | |
I tried to come up with a patch, but the issue isn't as easy as it seems, the proposed change is too simplistic. Leading spaces in a line is already used for one purpose : continuations of a previous line. For instance : option = value continued here gives "option" as key and "value\n continued here" as value. The proposal conflicts with this behavior, since having : option1 = value1 option2 = value2 creates only one key-value pair "option1":"value1\n option2=value2" Adding blank lines doesn't solve the issue. The only case when it's treated correctly is when the options is the first one of a section/file: there's no continuation since there's no previous option defined. One solution could be to check for the presence of a delimiter (colon or equals sign) and not treat it as a continuation if that's the case, but that could potentially break existing configurations files, since nothing forbids you from using delimiters in the values. Any opinion ? (By the way, the leading whitespaces for comments isn't affected by all this, the implementation is simple) |
|||
| msg62993 - (view) | Author: Ken Lalonde (kenlalonde) | Date: 2008年02月25日 19:26 | |
Quentin: I didn't appreciate the line-continuation issue. Breaking existing code is out of the question, so I'd like to retract that part of the patch. |
|||
| msg63047 - (view) | Author: Quentin Gallet-Gilles (quentin.gallet-gilles) | Date: 2008年02月26日 15:31 | |
Okay, I'll upload a patch with unit tests and doc changes for the comment part in the next few days. |
|||
| msg64482 - (view) | Author: Quentin Gallet-Gilles (quentin.gallet-gilles) | Date: 2008年03月25日 13:59 | |
Didn't think "a few days" would translate into a month. My bad! Anyway, here's the promised patch. |
|||
| msg66523 - (view) | Author: Jeremy Thurgood (jerith) | Date: 2008年05月10日 14:01 | |
This looks very much like a duplicate of issue 1714. Perhaps the two should be merged? |
|||
| msg66583 - (view) | Author: Jonatas Oliveira (jonatasoliveira) | Date: 2008年05月10日 20:23 | |
The patch cfgparser_comments.patch works for me. I agree with Jeremy Thurgood about the issue 1714. |
|||
| msg109818 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2010年07月10日 05:41 | |
I closed #1714 as a duplicate of this. It also has a patch attached. |
|||
| msg111659 - (view) | Author: Łukasz Langa (lukasz.langa) * (Python committer) | Date: 2010年07月26日 18:11 | |
Implemented as part of issue1682942 since it touches the same code. Moreover, this issue mentions Samba config parsing in the original comment (msg50719) which was not doable without the changes introduced by issue1682942. So I would supersede this issue with issue1682942. One way or the other, they both fly or both go. Michael, can you close this as superseded? |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:18 | admin | set | github: 43689 |
| 2010年07月26日 20:17:23 | terry.reedy | set | superseder: ConfigParser support for alt delimiters |
| 2010年07月26日 18:13:24 | michael.foord | set | status: open -> closed resolution: duplicate stage: resolved |
| 2010年07月26日 18:11:45 | lukasz.langa | set | nosy:
+ michael.foord, lukasz.langa messages: + msg111659 |
| 2010年07月10日 05:41:57 | terry.reedy | link | issue1714 superseder |
| 2010年07月10日 05:41:44 | terry.reedy | set | nosy:
+ christian.heimes, schmir, akuchling, msuchy, terry.reedy messages: + msg109818 versions: + Python 3.2, - Python 2.6, Python 3.0 |
| 2008年05月10日 20:23:28 | jonatasoliveira | set | nosy:
+ jonatasoliveira messages: + msg66583 |
| 2008年05月10日 14:01:11 | jerith | set | nosy:
+ jerith messages: + msg66523 |
| 2008年03月25日 13:59:55 | quentin.gallet-gilles | set | files:
+ cfgparser_comments.patch keywords: + patch messages: + msg64482 |
| 2008年03月06日 19:11:11 | draghuram | set | nosy: + draghuram |
| 2008年02月26日 15:31:04 | quentin.gallet-gilles | set | messages: + msg63047 |
| 2008年02月25日 19:26:09 | kenlalonde | set | messages: + msg62993 |
| 2008年02月24日 00:36:51 | quentin.gallet-gilles | set | nosy:
+ quentin.gallet-gilles messages: + msg62856 |
| 2008年02月23日 22:05:03 | facundobatista | set | keywords: + easy, - patch |
| 2008年02月23日 22:03:58 | georg.brandl | set | type: enhancement versions: + Python 2.6, Python 3.0 |
| 2006年07月18日 21:17:05 | kenlalonde | create | |