Commit Graph

80 Commits

Author SHA1 Message Date
Fred Drake cc43b56960 - apply patch from issue 7005
- add corresponding documentation
2010-02-19 05:24:30 +00:00
Georg Brandl 73709e62ff #5741 followup: should also allow %%(blah)s. 2009-04-13 12:36:24 +00:00
Georg Brandl 21cf5ee6fd #5741: dont disallow double percent signs in SafeConfigParser.set() keys. 2009-04-12 17:24:11 +00:00
Raymond Hettinger e89b8e9832 Backport 70111: Let configparser use ordered dicts by default. 2009-03-03 05:00:37 +00:00
Brett Cannon 97b1fb6a98 Remove a __getitem__() removal on an exception to silence a warning triggered
under -3.
2008-08-02 03:37:50 +00:00
Georg Brandl 392c6fc02d ConfigParser renaming reversal part 3: move module into place and adapt imports. 2008-05-25 07:25:25 +00:00
Alexandre Vassalotti e3a23c0734 Renamed the ConfigParser module to 'configparser'. 2008-05-14 22:07:07 +00:00
Facundo Batista b12f0b581a Issue 1781. Now ConfigParser.add_section does not let you add a
DEFAULT section any more, because it duplicated sections with
the rest of the machinery. Thanks Tim Lesher and Manuel Kaufmann.
2008-02-23 12:46:10 +00:00
Brett Cannon 229cee2d3d Deprecate BaseException.message as per PEP 352. 2007-05-05 01:34:02 +00:00
Georg Brandl 92a6baed7b Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
2007-03-13 17:43:32 +00:00
Martin v. Löwis a00bcac003 Patch #1371075: Make ConfigParser accept optional dict type
for ordering, sorting, etc.
2006-12-03 12:01:53 +00:00
Georg Brandl 7eb4b7d177 Fix all wrong instances of "it's". 2005-07-22 21:49:32 +00:00
David Goodger 1cbf206d32 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. 2004-10-03 15:55:09 +00:00
David Goodger 68a1abdade SF bug #1017864: ConfigParser now correctly handles default keys, processing them with ``ConfigParser.optionxform`` when supplied, consistent with the handling of config file entries and runtime-set options. 2004-10-03 15:40:25 +00:00
Fred Drake 82903148a8 ConfigParser:
- read() method returns a list of files parsed successfully
- add tests, documentation
(closes SF patch #677651)
2004-05-18 04:24:02 +00:00
Fred Drake abc086fb0d ConfigParser:
- don't allow setting options to non-string values; raise TypeError
  when the value is set, instead of raising an arbitrary exception
  later (such as when string interpolation is performed)
- add tests, documentation
(closes SF bug #810843)
2004-05-18 03:29:52 +00:00
Fred Drake bc12b01d83 ConfigParser:
- ensure that option names in interpolations are handled by
  self.optionxform in the same way that other references to option
  names
- add tests, documentation
(closes SF bug #857881, patch #865455)
2004-05-18 02:25:51 +00:00
Raymond Hettinger bac788a3cd Replace str.find()!=1 with the more readable "in" operator. 2004-05-04 09:21:43 +00:00
Walter Dörwald 70a6b49821 Replace backticks with repr() or "%r"
From SF patch #852334.
2004-02-12 17:35:32 +00:00
Fred Drake 8c4da53afe Make both items() methods return lists; one had changed to return an
iterator where it probably shouldn't have.
Closes SF bug #818861.
2003-10-21 16:45:00 +00:00
Walter Dörwald f0dfc7ac5c Fix a bunch of typos in documentation, docstrings and comments.
(From SF patch #810751)
2003-10-20 14:01:56 +00:00
Raymond Hettinger 99c2d531d1 SF patch #790443: add SafeConfigParser to __all__
(Contributed by George Yoshida.)
2003-09-01 23:30:44 +00:00
Neal Norwitz 10f3018023 Fix arguments for instantiating InterpolationSyntaxError 2003-06-29 04:23:35 +00:00
Fred Drake e2c649126e Further cleanup of exceptions. All interpolation-related exceptions
now derive from InterpolationError, which is not raised directly (only
subclasses get raised).  This matches what the docs already said.
2002-12-31 17:23:27 +00:00
Fred Drake 00dc5a93c1 ConfigParser._interpolate(): Pass the missing key to the
InterpolationError constructor, not the KeyError exception itself.
    (Caught by the new InterpolationError test.)

SafeConfigParser._interpolate_some():  Pass the right number of
    arguments to the InterpolationError constructor.
    (Caught by pychecker.)
2002-12-31 06:55:41 +00:00
Fred Drake 8d5dd98a2e - added InterpolationSyntaxError to __all__
- added docstring to exceptions
2002-12-30 23:51:45 +00:00
Neal Norwitz ce1d944b6b Add missing InterpolationSyntaxError.
XXX Not sure this is correct.
2002-12-30 23:38:47 +00:00
Neal Norwitz f680cc460c Update doc for getboolean() to match code (ie, returning True/False)
Convert remaining uses of 1/0 to True/False
2002-12-17 01:56:47 +00:00
Tim Peters 230a60c6ec Whitespace normalization. 2002-11-09 05:08:07 +00:00
Andrew M. Kuchling 9050a517c8 Fix docstring typos 2002-11-06 14:51:20 +00:00
Fred Drake 0eebd5cef9 Implement a safer and more predictable interpolation approach.
Closes SF bug #511737.
2002-10-25 21:52:00 +00:00
Fred Drake df393bd46a According to the docs, __name__ is not exposed via the API except
indirectly via %(__name__)s.  Not sure why, but maintain the
documented behavior for the new items() method.

Be a little more efficient about how we compute the list of options in
the ConfigParser.items() method.
2002-10-25 20:41:30 +00:00
Fred Drake fce6557c6b Re-factor: Use a RawConfigParser base class and make ConfigParser a
derived class that adds the ugly string interpolation code.  In the
process, changed all "__" methods and instance variables to "_".
2002-10-25 18:08:18 +00:00
Fred Drake 176916a989 Allow internal whitespace in keys.
Closes SF bug #583248; backporting to r22-maint branch.
2002-09-27 16:21:18 +00:00
Fred Drake 2ca041fde0 items(): New method, provided by Gustavo Niemeyer in SF bug #545096. 2002-09-27 15:49:56 +00:00
Fred Drake c2ff9051d2 has_option(): Use the option name transform consistently.
Closes SF bug #561822.

Integrate the "code cleanup and general bug fix patch" (SF bug #545096),
contributed by Gustavo Niemeyer.  This is the portion of that patch that
does not add new functionality.
2002-09-27 15:33:11 +00:00
Walter Dörwald 65230a2de7 Remove uses of the string and types modules:
x in string.whitespace => x.isspace()
type(x) in types.StringTypes => isinstance(x, basestring)
isinstance(x, types.StringTypes) => isinstance(x, basestring)
type(x) is types.StringType => isinstance(x, str)
type(x) == types.StringType => isinstance(x, str)
string.split(x, ...) => x.split(...)
string.join(x, y) => y.join(x)
string.zfill(x, ...) => x.zfill(...)
string.count(x, ...) => x.count(...)
hasattr(types, "UnicodeType") => try: unicode except NameError:
type(x) != types.TupleTuple => not isinstance(x, tuple)
isinstance(x, types.TupleType) => isinstance(x, tuple)
type(x) is types.IntType => isinstance(x, int)

Do not mention the string module in the rlcompleter docstring.

This partially applies SF patch http://www.python.org/sf/562373
(with basestring instead of string). (It excludes the changes to
unittest.py and does not change the os.stat stuff.)
2002-06-03 15:58:32 +00:00
Raymond Hettinger 54f0222547 SF 563203. Replaced 'has_key()' with 'in'. 2002-06-01 14:18:47 +00:00
Raymond Hettinger 0f4940c0a8 Replaced boolean test with 'is None' 2002-06-01 00:57:55 +00:00
Fred Drake d451ec1cdb Clean up uses of some deprecated features.
Reported by Neal Norwitz on python-dev.
2002-04-26 02:29:55 +00:00
Tim Peters bc0e910826 Convert a pile of obvious "yes/no" functions to return bool. 2002-04-04 22:55:58 +00:00
Andrew M. Kuchling 00824ed733 [Bug #523301] ConfigParser.write() produces broken output for values that
were originally rfc822-like line continuations.
   Modified version of a patch from Matthias Ralfs.
2002-03-08 18:08:47 +00:00
Tim Peters e0c446bb4a Whitespace normalization. 2001-10-18 21:57:37 +00:00
Guido van Rossum fb06f75c5a Apply modified SF patch 467580: ConfigParser.getboolean(): FALSE, TRUE.
This patch allows ConfigParser.getboolean() to interpret TRUE,
    FALSE, YES, NO, ON and OFF instead just '0' and '1'.

    While just allowing '0' and '1' sounds more correct users often
    demand to use more descriptive directives in configuration
    files. Instead of forcing every programmer do brew his own
    solution a system should include the batteries for this.

[My modification to the patch is a slight rewording of the docstring
and use of lowercase instead of uppercase templates.  The code is
still case sensitive. GvR.]
2001-10-04 19:58:46 +00:00
Martin v. Löwis 339d0f720e Patch #445762: Support --disable-unicode
- Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled
- check for Py_USING_UNICODE in all places that use Unicode functions
- disables unicode literals, and the builtin functions
- add the types.StringTypes list
- remove Unicode literals from most tests.
2001-08-17 18:39:25 +00:00
Andrew M. Kuchling 7c2cf73811 Remove redefinition of has_option() method 2001-08-13 14:58:32 +00:00
Martin v. Löwis 02d893cfae Patch #444359: Remove unused imports. 2001-08-02 07:15:29 +00:00
Fred Drake beb6713ea7 When reading a continuation line, make sure we still use the transformed
name when filling in the internal data structures, otherwise we incorrectly
raise a KeyError.

This fixes SF bug #432369.
2001-07-06 17:22:48 +00:00
Fred Drake 3c823aa4b6 Make sure ConfigParser uses .optionxform() consistently; this affects
.has_option(), .remove_option(), and .set().

This closes SF tracker #232913.
2001-02-26 21:55:34 +00:00
Fred Drake d4df94b56d Be much more permissive in what we accept in section names; there has been
at least one addition to the set of accepted characters for every release
since this module was first added; this should take care of the problem
in a more substantial way.

This closes SF bug #132288.
2001-02-14 15:24:17 +00:00