Index: Doc/lib/libcfgparser.tex
===================================================================
--- Doc/lib/libcfgparser.tex (revision 54408)
+++ Doc/lib/libcfgparser.tex (working copy)
@@ -54,14 +54,18 @@
the sections will be sorted on write-back, as will be the keys within
each section.
-\begin{classdesc}{RawConfigParser}{\optional{defaults\optional{, dict_type}}}
+\begin{classdesc}{RawConfigParser}{\optional{defaults\optional{, dict_type}}\optional{, delimiters=\("=", ":"\)}}
The basic configuration object. When \var{defaults} is given, it is
initialized into the dictionary of intrinsic defaults. When \var{dict_type}
is given, it will be used to create the dictionary objects for the list
of sections, for the options within a section, and for the default values.
+When a list of single-characters is provided in \var{delimiters}, it will
+override the default separators between keys and values in the configuration
+file. The first such delimiter is always used in writing the file out.
This class does not support the magical interpolation behavior.
\versionadded{2.3}
\versionchanged[\var{dict_type} was added]{2.6}
+\versionchanged[\var{delimiters} was added]{2.6}
\end{classdesc}
\begin{classdesc}{ConfigParser}{\optional{defaults}}
Index: Lib/ConfigParser.py
===================================================================
--- Lib/ConfigParser.py (revision 54408)
+++ Lib/ConfigParser.py (working copy)
@@ -24,11 +24,16 @@
methods:
- __init__(defaults=None)
+ __init__(defaults=None, dict_type=dict, delimiters=('=', ':'))
create the parser and specify a dictionary of intrinsic defaults. The
keys must be strings, the values must be appropriate for %()s string
interpolation. Note that `__name__' is always an intrinsic default;
- its value is the section's name.
+ its value is the section's name. When dict_type is given, it will be
+ used to create the dictionary objects for the list of sections, for the
+ options within a section, and for the default values. When delimiters
+ is specified, the provided list of single characters will be used to
+ determine the separation between keys and values in options.
+ When writing a config file, the first delimiter is used.
sections()
return all the configuration section names, sans DEFAULT
@@ -200,7 +205,13 @@
class RawConfigParser:
- def __init__(self, defaults=None, dict_type=dict):
+ SECTCRE = re.compile(
+ r'\[' # [
+ r'(?P