summaryrefslogtreecommitdiffstats
path: root/Lib/ConfigParser.py
Commit message (Collapse)AuthorAgeFilesLines
* Further cleanup of exceptions. All interpolation-related exceptionsFred Drake2002-12-311-30/+37
| | | | | now derive from InterpolationError, which is not raised directly (only subclasses get raised). This matches what the docs already said.
* ConfigParser._interpolate(): Pass the missing key to theFred Drake2002-12-311-4/+3
| | | | | | | | | 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.)
* - added InterpolationSyntaxError to __all__Fred Drake2002-12-301-4/+25
| | | | - added docstring to exceptions
* Add missing InterpolationSyntaxError.Neal Norwitz2002-12-301-0/+2
| | | | XXX Not sure this is correct.
* Update doc for getboolean() to match code (ie, returning True/False)Neal Norwitz2002-12-171-8/+8
| | | | Convert remaining uses of 1/0 to True/False
* Whitespace normalization.Tim Peters2002-11-091-1/+1
|
* Fix docstring typosAndrew M. Kuchling2002-11-061-2/+2
|
* Implement a safer and more predictable interpolation approach.Fred Drake2002-10-251-0/+48
| | | | Closes SF bug #511737.
* According to the docs, __name__ is not exposed via the API exceptFred Drake2002-10-251-2/+8
| | | | | | | | 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.
* Re-factor: Use a RawConfigParser base class and make ConfigParser aFred Drake2002-10-251-103/+133
| | | | | derived class that adds the ugly string interpolation code. In the process, changed all "__" methods and instance variables to "_".
* Allow internal whitespace in keys.Fred Drake2002-09-271-3/+4
| | | | Closes SF bug #583248; backporting to r22-maint branch.
* items(): New method, provided by Gustavo Niemeyer in SF bug #545096.Fred Drake2002-09-271-0/+33
|
* has_option(): Use the option name transform consistently.Fred Drake2002-09-271-53/+49
| | | | | | | | 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.
* Remove uses of the string and types modules:Walter Dörwald2002-06-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | 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.)
* SF 563203. Replaced 'has_key()' with 'in'.Raymond Hettinger2002-06-011-8/+8
|
* Replaced boolean test with 'is None'Raymond Hettinger2002-06-011-1/+1
|
* Clean up uses of some deprecated features.Fred Drake2002-04-261-2/+2
| | | | Reported by Neal Norwitz on python-dev.
* Convert a pile of obvious "yes/no" functions to return bool.Tim Peters2002-04-041-2/+2
|
* [Bug #523301] ConfigParser.write() produces broken output for values thatAndrew M. Kuchling2002-03-081-2/+2
| | | | | were originally rfc822-like line continuations. Modified version of a patch from Matthias Ralfs.
* Whitespace normalization.Tim Peters2001-10-181-1/+1
|
* Apply modified SF patch 467580: ConfigParser.getboolean(): FALSE, TRUE.Guido van Rossum2001-10-041-6/+8
| | | | | | | | | | | | | | 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.]
* Patch #445762: Support --disable-unicodeMartin v. Löwis2001-08-171-2/+2
| | | | | | | | - 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.
* Remove redefinition of has_option() methodAndrew M. Kuchling2001-08-131-7/+0
|
* Patch #444359: Remove unused imports.Martin v. Löwis2001-08-021-1/+0
|
* When reading a continuation line, make sure we still use the transformedFred Drake2001-07-061-1/+2
| | | | | | | name when filling in the internal data structures, otherwise we incorrectly raise a KeyError. This fixes SF bug #432369.
* Make sure ConfigParser uses .optionxform() consistently; this affectsFred Drake2001-02-261-0/+3
| | | | | | .has_option(), .remove_option(), and .set(). This closes SF tracker #232913.
* Be much more permissive in what we accept in section names; there has beenFred Drake2001-02-141-1/+1
| | | | | | | | 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.
* Allow square brackets in the option names; this makes it possible to useFred Drake2001-02-121-1/+1
| | | | | | | ConfigParser with GNOME-ish config files that use the internationalization conventions found in GNOME. This closes SF bug #131635.
* Correction after second code path test.Eric S. Raymond2001-02-091-1/+1
|
* String method conversion.Eric S. Raymond2001-02-091-8/+8
|
* added __all__ lists to a number of Python modulesSkip Montanaro2001-01-201-0/+5
| | | | | | | | added test script and expected output file as well this closes patch 103297. __all__ attributes will be added to other modules without first submitting a patch, just adding the necessary line to the test script to verify more-or-less correct implementation.
* Whitespace normalization.Tim Peters2001-01-141-8/+8
|
* Make ConfigParser.Error inherit from Exception.Fred Drake2000-12-111-1/+3
|
* remove_option(): Use the right variable name for the option name!Fred Drake2000-12-041-2/+2
| | | | This closes bug #124324.
* Allow spaces in section names.Fred Drake2000-09-271-18/+33
| | | | | | | | | | | | | | | Do not expose the __name__ when reporting the list of options available for a section since that is for internal use. This closes SourceForge bug #115357. Additionally, define InterpolationDepthError and MAX_INTERPOLATION_DEPTH. The exception is raised by get*() when value interpolation cannot be completed within the defined recursion limit. The constant is only informative; changing it will not affect the allowed depth. Fix the exit from get() so that None is not returned if the depth is met or exceeded; either return the value of raise InterpolationDepthError.
* When reading the file, option names were not passed throughGuido van Rossum2000-09-251-1/+1
| | | | | | | self.optionxform(), which (in the default case) caused options spelled with opper case letters in their name to be inaccessible. Reported by "Todd R. Palmer" <t2palmer@bellsouth.net> on activepython@listserv1.ActiveState.com.
* Small fixes by Petru Paler (patch #100946) checked in with esr's approval.Thomas Wouters2000-07-211-2/+2
|
* ConfigParser enhancements to edit existing configs, part 2Eric S. Raymond2000-07-141-5/+41
|
* Give ConfigParser the capability to set as well as read options, and to writeEric S. Raymond2000-07-101-0/+36
| | | | | | | | | | | | | 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.
* ConfigParser.read():Fred Drake2000-05-091-1/+1
| | | | | Instead of wrapping 'filenames' value in a list if it's a string, wrap it if it's a string or unicode string.
* allow comments beginning with ; in key: value as well as key = valueJeremy Hylton2000-03-031-1/+1
|
* Fix comments relating to the specific regexs used to parse section andFred Drake2000-02-281-2/+2
| | | | option names; errors noted by Greg Stein <gstein@lyra.org>.
* (Finally!) Changes related to the ConfigParser/INI-file topicsFred Drake2000-02-281-5/+11
| | | | | | | discussed on c.l.py last January. Specifically: - more characters allowed in section & option names - if '=' is used to separate the option & value, the value can be followed by a comment of the form '\s;'
* fixed a typo in a docstring, and slightly expanded the moduleBarry Warsaw1999-10-121-3/+2
| | | | docstring info for readfp().
* Added has_option(); fix bug in get() which botched interpolation ifGuido van Rossum1999-10-041-1/+16
| | | | '%(' was found in first position (found by Fred Drake).
* Urmpfh!Guido van Rossum1999-10-041-8/+43
| | | | | | | | | | | | | | | | | | | | | Withdraw the change that Fred just checked in -- it was a poorly documented feature, not a bug, to ignore I/O errors in read(). The new docstring explains the reason for the feature: """ this is designed so that you can specifiy a list of potential configuration file locations (e.g. current directory, user's home directory, systemwide directory), and all existing configuration files in the list will be read. """ Also add a lower-level function, readfp(), which takes an open file object (and optionally a filename). XXX There are some other problems with this module, but I don't have time to dig into these; in particular, there are complaints that the %(name)s substitution from the [DEFAULTS] section doesn't work correctly.
* ConfigParser.read(): Don't mask IOError exceptions.Fred Drake1999-10-041-5/+3
|
* Patch suggested (and partially provided) by Lars Damerow: instead ofGuido van Rossum1999-06-171-5/+8
| | | | | | always lowercasing the option name, call a method optionxform() which can be overridden. Also make the regexps SECTRE and OPTRE non-private variables so they can also be overridden.
* Fix by Chris Petrilli (to his own code) to limit the number ofGuido van Rossum1999-02-121-1/+3
| | | | iterations looking for expansions to 10.
* From: Mike Orr <mso@oz.net>Guido van Rossum1999-01-301-1/+1
| | | | | | | | | | | In the docstring of ConfigParser.py (Python 1.5.2b1): read(*filenames) -- read and parse the list of named configuration files should be: read(filenames) -- read and parse the list of named configuration files The method accepts a list, not a bunch of positional arguments. Which is good, the list is much more convenient.