mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +00:00
Make sure ConfigParser uses .optionxform() consistently; this affects
.has_option(), .remove_option(), and .set(). This closes SF tracker #232913.
This commit is contained in:
parent
ffc215a279
commit
3c823aa4b6
3 changed files with 28 additions and 0 deletions
|
@ -330,6 +330,7 @@ class ConfigParser:
|
|||
elif not self.has_section(section):
|
||||
return 0
|
||||
else:
|
||||
option = self.optionxform(option)
|
||||
return self.__sections[section].has_key(option)
|
||||
|
||||
def set(self, section, option, value):
|
||||
|
@ -341,6 +342,7 @@ class ConfigParser:
|
|||
sectdict = self.__sections[section]
|
||||
except KeyError:
|
||||
raise NoSectionError(section)
|
||||
option = self.optionxform(option)
|
||||
sectdict[option] = value
|
||||
|
||||
def write(self, fp):
|
||||
|
@ -368,6 +370,7 @@ class ConfigParser:
|
|||
sectdict = self.__sections[section]
|
||||
except KeyError:
|
||||
raise NoSectionError(section)
|
||||
option = self.optionxform(option)
|
||||
existed = sectdict.has_key(option)
|
||||
if existed:
|
||||
del sectdict[option]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue