summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArfrever <arfrever@gentoo.org>2011-12-30 12:34:14 -0500
committerAnthony G. Basile <blueness@gentoo.org>2011-12-30 12:34:25 -0500
commit9dbea9ba4215269135dce31918073d09dd9aa790 (patch)
tree1819e7407673c45677eba1e413628f3e847d491f
parentUpdate syntax of octal numbers for compatibility with Python 3. (diff)
downloadwebapp-config-9dbea9ba4215269135dce31918073d09dd9aa790.tar.gz
webapp-config-9dbea9ba4215269135dce31918073d09dd9aa790.tar.bz2
webapp-config-9dbea9ba4215269135dce31918073d09dd9aa790.zip
Don't use has_key() for compatibility with Python 3.
Reported-By: Arfrever <arfrever@gentoo.org> Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r--WebappConfig/config.py12
-rw-r--r--WebappConfig/debug.py12
-rw-r--r--WebappConfig/dotconfig.py2
3 files changed, 13 insertions, 13 deletions
diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index e4f4819..65f8efa 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -797,11 +797,11 @@ class Config:
# Handle -E
envmap = []
- if (options.__dict__.has_key('envall') and
+ if ('envall' in options.__dict__ and
options.__dict__['envall']):
envmap = 'all'
- elif (options.__dict__.has_key('envvar') and
+ elif ('envvar' in options.__dict__ and
options.__dict__['envvar']):
envmap = [x.lower() for x in options.__dict__['envvar']]
@@ -818,7 +818,7 @@ class Config:
key.lower(),
value)
- if (options.__dict__.has_key('define') and
+ if ('define' in options.__dict__ and
options.__dict__['define']):
for i in options.__dict__['define']:
if '=' in i:
@@ -827,7 +827,7 @@ class Config:
i.split('=')[1])
# Indicate that --dir was found
- if options.__dict__.has_key('dir'):
+ if 'dir' in options.__dict__:
self.flag_dir = True
# Map command line options into the configuration
@@ -845,12 +845,12 @@ class Config:
'bug_report' : 'g_bugreport'}
for i in option_to_config.keys():
- if options.__dict__.has_key(i) and options.__dict__[i]:
+ if i in options.__dict__ and options.__dict__[i]:
self.config.set('USER', option_to_config[i],
str(options.__dict__[i]))
# handle verbosity
- if (options.__dict__.has_key('pretend')
+ if ('pretend' in options.__dict__
and options.__dict__['pretend']):
self.config.set('USER', 'g_verbose', 'True')
diff --git a/WebappConfig/debug.py b/WebappConfig/debug.py
index 7c14651..c3a5c47 100644
--- a/WebappConfig/debug.py
+++ b/WebappConfig/debug.py
@@ -169,26 +169,26 @@ class Message:
def cli_handle(self, options):
- if (options.__dict__.has_key('debug')
+ if ('debug' in options.__dict__
and options.__dict__['debug']):
self.debug_on()
else:
self.debug_off()
return
- if (options.__dict__.has_key('debug_class_vars')
+ if ('debug_class_vars' in options.__dict__
and options.__dict__['debug_class_vars']):
self.class_variables_on()
else:
self.class_variables_off()
- if (options.__dict__.has_key('debug_nocolor')
+ if ('debug_nocolor' in options.__dict__
and options.__dict__['debug_nocolor']):
self.color_off()
else:
self.color_on()
- if (options.__dict__.has_key('debug_level') and
+ if ('debug_level' in options.__dict__ and
options.__dict__['debug_level']):
dbglvl = int(options.__dict__['debug_level'])
if dbglvl < 0:
@@ -197,7 +197,7 @@ class Message:
dbglvl = 10
self.set_debug_level(dbglvl)
- if (options.__dict__.has_key('debug_verbose') and
+ if ('debug_verbose' in options.__dict__ and
options.__dict__['debug_verbose']):
dbgvrb = int(options.__dict__['debug_verbose'])
if dbgvrb < 1:
@@ -210,7 +210,7 @@ class Message:
('debug_classes', self.set_debug_classes),
('debug_variables', self.set_debug_variables),]:
- if (options.__dict__.has_key(i[0]) and
+ if (i[0] in options.__dict__ and
options.__dict__[i[0]]):
i[1](options.__dict__[i[0]])
diff --git a/WebappConfig/dotconfig.py b/WebappConfig/dotconfig.py
index c9a5ba1..610d1e3 100644
--- a/WebappConfig/dotconfig.py
+++ b/WebappConfig/dotconfig.py
@@ -163,7 +163,7 @@ class DotConfig:
self.read()
- if self.__data.has_key('WEB_CATEGORY'):
+ if 'WEB_CATEGORY' in self.__data:
OUT.notice(self.__data['WEB_CATEGORY'] + ' ' +
self.__data['WEB_PN'] + ' ' +
self.__data['WEB_PVR'])