[Python-checkins] CVS: python/dist/src/Doc/lib libcfgparser.tex,1.10,1.11

Eric S. Raymond python-dev@python.org
Mon, 10 Jul 2000 11:11:02 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv18589/dist/src/Doc/lib

Modified Files:
	libcfgparser.tex 
Log Message:
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.


Index: libcfgparser.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcfgparser.tex,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** libcfgparser.tex	2000/05/23 02:28:26	1.10
--- libcfgparser.tex	2000/07/10 18:10:59	1.11
***************
*** 6,9 ****
--- 6,10 ----
  \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}
  
***************
*** 114,117 ****
--- 115,123 ----
  \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
***************
*** 148,150 ****
--- 154,167 ----
  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}