Commit 90f84922 authored by Kurt B. Kaiser's avatar Kurt B. Kaiser

Add 'raw' support to configHandler. Patch 1650174 Tal Einat.

parent f5400032
...@@ -3,6 +3,8 @@ What's New in IDLE 2.6a1? ...@@ -3,6 +3,8 @@ What's New in IDLE 2.6a1?
*Release date: XX-XXX-200X* *Release date: XX-XXX-200X*
- Add 'raw' support to configHandler. Patch 1650174 Tal Einat.
- Avoid hang when encountering a duplicate in a completion list. Bug 1571112. - Avoid hang when encountering a duplicate in a completion list. Bug 1571112.
- Patch #1362975: Rework CodeContext indentation algorithm to - Patch #1362975: Rework CodeContext indentation algorithm to
......
...@@ -39,22 +39,19 @@ class IdleConfParser(ConfigParser): ...@@ -39,22 +39,19 @@ class IdleConfParser(ConfigParser):
self.file=cfgFile self.file=cfgFile
ConfigParser.__init__(self,defaults=cfgDefaults) ConfigParser.__init__(self,defaults=cfgDefaults)
def Get(self, section, option, type=None, default=None): def Get(self, section, option, type=None, default=None, raw=False):
""" """
Get an option value for given section/option or return default. Get an option value for given section/option or return default.
If type is specified, return as type. If type is specified, return as type.
""" """
if not self.has_option(section, option):
return default
if type=='bool': if type=='bool':
getVal=self.getboolean return self.getboolean(section, option)
elif type=='int': elif type=='int':
getVal=self.getint return self.getint(section, option)
else:
getVal=self.get
if self.has_option(section,option):
#return getVal(section, option, raw, vars, default)
return getVal(section, option)
else: else:
return default return self.get(section, option, raw=raw)
def GetOptionList(self,section): def GetOptionList(self,section):
""" """
...@@ -219,7 +216,7 @@ class IdleConf: ...@@ -219,7 +216,7 @@ class IdleConf:
return userDir return userDir
def GetOption(self, configType, section, option, default=None, type=None, def GetOption(self, configType, section, option, default=None, type=None,
warn_on_default=True): warn_on_default=True, raw=False):
""" """
Get an option value for given config type and given general Get an option value for given config type and given general
configuration section/option or return a default. If type is specified, configuration section/option or return a default. If type is specified,
...@@ -233,9 +230,11 @@ class IdleConf: ...@@ -233,9 +230,11 @@ class IdleConf:
""" """
if self.userCfg[configType].has_option(section,option): if self.userCfg[configType].has_option(section,option):
return self.userCfg[configType].Get(section, option, type=type) return self.userCfg[configType].Get(section, option,
type=type, raw=raw)
elif self.defaultCfg[configType].has_option(section,option): elif self.defaultCfg[configType].has_option(section,option):
return self.defaultCfg[configType].Get(section, option, type=type) return self.defaultCfg[configType].Get(section, option,
type=type, raw=raw)
else: #returning default, print warning else: #returning default, print warning
if warn_on_default: if warn_on_default:
warning = ('\n Warning: configHandler.py - IdleConf.GetOption -\n' warning = ('\n Warning: configHandler.py - IdleConf.GetOption -\n'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment