[issue7005] ConfigParser does not handle options without values
New submission from Mats Kindahl : When ConfigParser is used to read in a my.cnf file (MySQL Server Configuration File), it fails for options that do not have value. ConfigParser is designed to require a value for each option, but some systems, such as MySQL option file reader, accepts options without values. Reading a my.cnf file is almost certain to include options without values. The server can accept options with values even though the value is not necessary, but there are some tools that do not allow values for options that do not require them. There is an attached patch that optionally will allow options to not have a value. In order to distinguish options with no value from options with the empty string, None is assigned to options without values. The default behavior is to not allow options without values. -- components: Library (Lib) files: cfgparser-1.patch keywords: patch messages: 93168 nosy: mkindahl severity: normal status: open title: ConfigParser does not handle options without values versions: Python 2.6 Added file: http://bugs.python.org/file14985/cfgparser-1.patch ___ Python tracker <http://bugs.python.org/issue7005> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7005] ConfigParser does not handle options without values
Mats Kindahl added the comment: I replied to the mail, but I don't know if it is attached to the issue, so I'll repeat here. I'll change the "value is not None" to just "value" where I used that idiom. The style of using options without values is quite common in my.cnf files used by MySQL programs. For example, in the Debian (Ubuntu) package I have installed is using several options without values. -- ___ Python tracker <http://bugs.python.org/issue7005> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7005] ConfigParser does not handle options without values
Mats Kindahl added the comment: Fred L. Drake, Jr. wrote: > Fred L. Drake, Jr. added the comment: > > The test "value is not None" in line 620 (of the new version) could be > just "value" and get a little more value from less code. OK. > > I don't think I've ever run across a sample .ini-style file that used > unspecified values, though it's frequently done in "flat" configuration > files. > > Have you come across an existing configuration format that uses the > [section] markers and unspecified values, or is this really a new use-case? It is very common in my.cnf files for MySQL, and has been so "for ever." For example, the default my.cnf file that is installed on my Debian (Ubuntu) system have several options without values (e.g., skip-external-locking, quick, and quote-names). Best wishes, Mats Kindahl > > -- > > ___ > Python tracker > <http://bugs.python.org/issue7005> > ___ -- ___ Python tracker <http://bugs.python.org/issue7005> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7005] ConfigParser does not handle options without values
Mats Kindahl added the comment: Adding patch with the changes requested by Fred. -- Added file: http://bugs.python.org/file14993/cfgparser-2.patch ___ Python tracker <http://bugs.python.org/issue7005> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7005] ConfigParser does not handle options without values
Mats Kindahl added the comment: So, what is the status on this? Who needs to review it? Is there anything I can do to get it accepted? Do I need to make any changes (in addition to those already suggested and done by fdrake)? -- ___ Python tracker <http://bugs.python.org/issue7005> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com