diff options
author | David Goodger <goodger@python.org> | 2004-10-03 15:55:09 (GMT) |
---|---|---|
committer | David Goodger <goodger@python.org> | 2004-10-03 15:55:09 (GMT) |
commit | 1cbf206d322ad1fac12b4bb5a64d501ca021a61d (patch) | |
tree | 31ad42e2d25206665e9e3b381220967b358b87dd /Doc/lib/libcfgparser.tex | |
parent | 68a1abdadec2377fd3e8d2211cb3cc119de77a28 (diff) | |
download | cpython-1cbf206d322ad1fac12b4bb5a64d501ca021a61d.zip cpython-1cbf206d322ad1fac12b4bb5a64d501ca021a61d.tar.gz cpython-1cbf206d322ad1fac12b4bb5a64d501ca021a61d.tar.bz2 |
SF bug #997050: Document, test, & check for non-string values in ConfigParser. Moved the new string-only restriction added in rev. 1.65 to the SafeConfigParser class, leaving existing ConfigParser & RawConfigParser behavior alone, and documented the conditions under which non-string values work.
Diffstat (limited to 'Doc/lib/libcfgparser.tex')
-rw-r--r-- | Doc/lib/libcfgparser.tex | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/Doc/lib/libcfgparser.tex b/Doc/lib/libcfgparser.tex index bc15655..42a362e 100644 --- a/Doc/lib/libcfgparser.tex +++ b/Doc/lib/libcfgparser.tex @@ -238,10 +238,12 @@ option in the given \var{section}. \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}. \var{value} must be a -string (\class{str} or \class{unicode}); if not, \exception{TypeError} -is raised. +If the given section exists, set the given option to the specified +value; otherwise raise \exception{NoSectionError}. While it is +possible to use \class{RawConfigParser} (or \class{ConfigParser} with +\var{raw} parameters set to true) for \emph{internal} storage of +non-string values, full functionality (including interpolation and +output to files) can only be achieved using string values. \versionadded{1.6} \end{methoddesc} @@ -281,8 +283,6 @@ option names case sensitive. The \class{ConfigParser} class extends some methods of the \class{RawConfigParser} interface, adding some optional arguments. -The \class{SafeConfigParser} class implements the same extended -interface. \begin{methoddesc}{get}{section, option\optional{, raw\optional{, vars}}} Get an \var{option} value for the named \var{section}. All the @@ -297,3 +297,17 @@ option in the given \var{section}. Optional arguments have the same meaning as for the \method{get()} method. \versionadded{2.3} \end{methoddesc} + + +\subsection{SafeConfigParser Objects \label{SafeConfigParser-objects}} + +The \class{SafeConfigParser} class implements the same extended +interface as \class{ConfigParser}, with the following addition: + +\begin{methoddesc}{set}{section, option, value} +If the given section exists, set the given option to the specified +value; otherwise raise \exception{NoSectionError}. \var{value} must +be a string (\class{str} or \class{unicode}); if not, +\exception{TypeError} is raised. +\versionadded{2.4} +\end{methoddesc} |