summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2007-02-05 06:03:18 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2007-02-05 06:03:18 (GMT)
commit90f84922ee0de633ab9d552b2021789290573185 (patch)
tree5efdd7961c3f31c4ddec13dbd8cffcef779519d7
parentf54000325b49c36c6bfb4632137a9a20c8fa2e3c (diff)
downloadcpython-90f84922ee0de633ab9d552b2021789290573185.zip
cpython-90f84922ee0de633ab9d552b2021789290573185.tar.gz
cpython-90f84922ee0de633ab9d552b2021789290573185.tar.bz2
Add 'raw' support to configHandler. Patch 1650174 Tal Einat.
-rw-r--r--Lib/idlelib/NEWS.txt2
-rw-r--r--Lib/idlelib/configHandler.py23
2 files changed, 13 insertions, 12 deletions
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index 5f73a69..ed69731 100644
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -3,6 +3,8 @@ What's New in IDLE 2.6a1?
*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.
- Patch #1362975: Rework CodeContext indentation algorithm to
diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py
index 826fb5d..3318416 100644
--- a/Lib/idlelib/configHandler.py
+++ b/Lib/idlelib/configHandler.py
@@ -39,22 +39,19 @@ class IdleConfParser(ConfigParser):
self.file=cfgFile
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.
If type is specified, return as type.
"""
+ if not self.has_option(section, option):
+ return default
if type=='bool':
- getVal=self.getboolean
+ return self.getboolean(section, option)
elif type=='int':
- getVal=self.getint
- else:
- getVal=self.get
- if self.has_option(section,option):
- #return getVal(section, option, raw, vars, default)
- return getVal(section, option)
+ return self.getint(section, option)
else:
- return default
+ return self.get(section, option, raw=raw)
def GetOptionList(self,section):
"""
@@ -219,7 +216,7 @@ class IdleConf:
return userDir
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
configuration section/option or return a default. If type is specified,
@@ -233,9 +230,11 @@ class IdleConf:
"""
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):
- 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
if warn_on_default:
warning = ('\n Warning: configHandler.py - IdleConf.GetOption -\n'