summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/configHandler.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2002-11-30 19:10:19 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2002-11-30 19:10:19 (GMT)
commit5b0b00fb21fe2649a60f9d8cd107d7efe6bc9dec (patch)
tree0182f23e2c68a189d2dfcccb5f1f921ecde7d41b /Lib/idlelib/configHandler.py
parent672ce57100dac7035015d15cc2fa734a0c6c113e (diff)
downloadcpython-5b0b00fb21fe2649a60f9d8cd107d7efe6bc9dec.zip
cpython-5b0b00fb21fe2649a60f9d8cd107d7efe6bc9dec.tar.gz
cpython-5b0b00fb21fe2649a60f9d8cd107d7efe6bc9dec.tar.bz2
Convert string exceptions to classes, string exceptions are deprecated
Diffstat (limited to 'Lib/idlelib/configHandler.py')
-rw-r--r--Lib/idlelib/configHandler.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py
index d3a88f2..6944388 100644
--- a/Lib/idlelib/configHandler.py
+++ b/Lib/idlelib/configHandler.py
@@ -11,6 +11,11 @@ Provides access to stored idle configuration information.
import os, sys, string
from ConfigParser import ConfigParser, NoOptionError, NoSectionError
+class InvalidConfigType(Exception): pass
+class InvalidConfigSet(Exception): pass
+class InvalidFgBg(Exception): pass
+class InvalidTheme(Exception): pass
+
class IdleConfParser(ConfigParser):
"""
A ConfigParser specialised for idle configuration file handling
@@ -228,13 +233,13 @@ class IdleConf:
configType must be one of ('main','extensions','highlight','keys')
"""
if not (configType in ('main','extensions','highlight','keys')):
- raise 'Invalid configType specified'
+ raise InvalidConfigType, 'Invalid configType specified'
if configSet == 'user':
cfgParser=self.userCfg[configType]
elif configSet == 'default':
cfgParser=self.defaultCfg[configType]
else:
- raise 'Invalid configSet specified'
+ raise InvalidConfigSet, 'Invalid configSet specified'
return cfgParser.sections()
def GetHighlight(self, theme, element, fgBg=None):
@@ -262,7 +267,7 @@ class IdleConf:
if fgBg == 'bg':
return highlight["background"]
else:
- raise 'Invalid fgBg specified'
+ raise InvalidFgBg, 'Invalid fgBg specified'
def GetThemeDict(self,type,themeName):
"""
@@ -278,7 +283,7 @@ class IdleConf:
elif type == 'default':
cfgParser=self.defaultCfg['highlight']
else:
- raise 'Invalid theme type specified'
+ raise InvalidTheme, 'Invalid theme type specified'
#foreground and background values are provded for each theme element
#(apart from cursor) even though all these values are not yet used
#by idle, to allow for their use in the future. Default values are
@@ -561,7 +566,7 @@ class IdleConf:
elif configSet=='default':
cfgParser=self.defaultCfg['main']
else:
- raise 'Invalid configSet specified'
+ raise InvalidConfigSet, 'Invalid configSet specified'
options=cfgParser.GetOptionList('HelpFiles')
for option in options:
value=cfgParser.Get('HelpFiles',option,default=';')