summaryrefslogtreecommitdiffstats
path: root/Doc/lib
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2000-07-10 18:11:00 (GMT)
committerEric S. Raymond <esr@thyrsus.com>2000-07-10 18:11:00 (GMT)
commit417c489defd33ceb4a3cb76efaf4975ee886221e (patch)
tree1a51f55578f47ba1f181b3b3f49ed81a7550ce06 /Doc/lib
parent3e3175b5e7cfdb5ad1ba087a5f0b01e414cbad40 (diff)
downloadcpython-417c489defd33ceb4a3cb76efaf4975ee886221e.zip
cpython-417c489defd33ceb4a3cb76efaf4975ee886221e.tar.gz
cpython-417c489defd33ceb4a3cb76efaf4975ee886221e.tar.bz2
Give ConfigParser the capability to set as well as read options, and to write
a representation of the configuration state in .ini format that can be read back in by a future read() call. Thus this class is now a back end for .ini editors as well as parsers. This patch is complete and tested, but exposes a bug in the ConfigParser implementation which I have not yet fixed. Because case information is discarded during parsing, the output of write() has its case smashed. I wrote this for a SourceForge interface script called forgetool. Documentation for the new entry points included.
Diffstat (limited to 'Doc/lib')
-rw-r--r--Doc/lib/libcfgparser.tex17
1 files changed, 17 insertions, 0 deletions
diff --git a/Doc/lib/libcfgparser.tex b/Doc/lib/libcfgparser.tex
index 2f3536b..32851f5 100644
--- a/Doc/lib/libcfgparser.tex
+++ b/Doc/lib/libcfgparser.tex
@@ -5,6 +5,7 @@
\modulesynopsis{Configuration file parser.}
\moduleauthor{Ken Manheimer}{klm@digicool.com}
\moduleauthor{Barry Warsaw}{bwarsaw@python.org}
+\moduleauthor{Eric S. Raymond}{esr@thyrsus.com}
\sectionauthor{Christopher G. Petrilli}{petrilli@amber.org}
This module defines the class \class{ConfigParser}.
@@ -113,6 +114,11 @@ configuration. The \code{DEFAULT} section is not acknowledged.
Returns a list of options available in the specified \var{section}.
\end{methoddesc}
+\begin{methoddesc}{has_option}{section, option}
+If the given section exists, and contains the given option. return 1;
+otherwise return 0. (New in 1.6)
+\end{methoddesc}
+
\begin{methoddesc}{read}{filenames}
Read and parse a list of filenames. If \var{filenames} is a string or
Unicode string, it is treated as a single filename.
@@ -148,3 +154,14 @@ A convenience method which coerces the \var{option} in the specified
for the option are \samp{0} and \samp{1}, any others will raise
\exception{ValueError}.
\end{methoddesc}
+
+\begin{methoddesc}{set}{section, option, value}
+If the given section exists, set the given option to the specified value;
+otherwise raise \exception{NoSectionError}. (New in 1.6)
+\end{methoddesc}
+
+\begin{methoddesc}{write}{fileobect}
+Write a representation of the configuration to the specified file
+object. This representation can be parsed by a future \method{read()}
+call. (New in 1.6)
+\end{methoddesc}