Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 583412
Collapse All | Expand All

(-)file_not_specified_in_diff (-6 / +15 lines)
Line  Link Here
0
-- Lib/ConfigParser.py
0
++ Lib/ConfigParser.py
Lines 94-99 Link Here
94
    _default_dict = dict
94
    _default_dict = dict
95
95
96
import re
96
import re
97
import string
97
98
98
__all__ = ["NoSectionError", "DuplicateSectionError", "NoOptionError",
99
__all__ = ["NoSectionError", "DuplicateSectionError", "NoOptionError",
99
           "InterpolationError", "InterpolationDepthError",
100
           "InterpolationError", "InterpolationDepthError",
Lines 106-111 Link Here
106
107
107
MAX_INTERPOLATION_DEPTH = 10
108
MAX_INTERPOLATION_DEPTH = 10
108
109
110
_lower_map = string.maketrans(string.ascii_uppercase, string.ascii_lowercase)
111
112
def _lower(value):
113
    if isinstance(value, str):
114
        return value.translate(_lower_map)
115
    else:
116
        return value.lower()
117
109
118
110
119
111
# exception classes
120
# exception classes
Lines 257-263 Link Here
257
        already exists. Raise ValueError if name is DEFAULT or any of it's
266
        already exists. Raise ValueError if name is DEFAULT or any of it's
258
        case-insensitive variants.
267
        case-insensitive variants.
259
        """
268
        """
260
        if section.lower() == "default":
269
        if _lower(section) == "default":
261
            raise ValueError, 'Invalid section name: %s' % section
270
            raise ValueError, 'Invalid section name: %s' % section
262
271
263
        if section in self._sections:
272
        if section in self._sections:
Lines 366-377 Link Here
366
375
367
    def getboolean(self, section, option):
376
    def getboolean(self, section, option):
368
        v = self.get(section, option)
377
        v = self.get(section, option)
369
        if v.lower() not in self._boolean_states:
378
        if _lower(v) not in self._boolean_states:
370
            raise ValueError, 'Not a boolean: %s' % v
379
            raise ValueError, 'Not a boolean: %s' % v
371
        return self._boolean_states[v.lower()]
380
        return self._boolean_states[_lower(v)]
372
381
373
    def optionxform(self, optionstr):
382
    def optionxform(self, optionstr):
374
        return optionstr.lower()
383
        return _lower(optionstr)
375
384
376
    def has_option(self, section, option):
385
    def has_option(self, section, option):
377
        """Check for the existence of a given option in a given section."""
386
        """Check for the existence of a given option in a given section."""
Lines 483-489 Link Here
483
            # comment or blank line?
492
            # comment or blank line?
484
            if line.strip() == '' or line[0] in '#;':
493
            if line.strip() == '' or line[0] in '#;':
485
                continue
494
                continue
486
            if line.split(None, 1)[0].lower() == 'rem' and line[0] in "rR":
495
            if _lower(line.split(None, 1)[0]) == 'rem' and line[0] in "rR":
487
                # no leading whitespace
496
                # no leading whitespace
488
                continue
497
                continue
489
            # continuation line?
498
            # continuation line?

Return to bug 583412