Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/webapp-config:master commit in: WebappConfig/
Date: Fri, 30 Dec 2011 17:34:50
Message-Id: 9dbea9ba4215269135dce31918073d09dd9aa790.blueness@gentoo
1 commit: 9dbea9ba4215269135dce31918073d09dd9aa790
2 Author: Arfrever <arfrever <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 30 17:34:14 2011 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 30 17:34:25 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/webapp-config.git;a=commit;h=9dbea9ba
7
8 Don't use has_key() for compatibility with Python 3.
9
10 Reported-By: Arfrever <arfrever <AT> gentoo.org>
11 Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
12
13 ---
14 WebappConfig/config.py | 12 ++++++------
15 WebappConfig/debug.py | 12 ++++++------
16 WebappConfig/dotconfig.py | 2 +-
17 3 files changed, 13 insertions(+), 13 deletions(-)
18
19 diff --git a/WebappConfig/config.py b/WebappConfig/config.py
20 index e4f4819..65f8efa 100644
21 --- a/WebappConfig/config.py
22 +++ b/WebappConfig/config.py
23 @@ -797,11 +797,11 @@ class Config:
24 # Handle -E
25 envmap = []
26
27 - if (options.__dict__.has_key('envall') and
28 + if ('envall' in options.__dict__ and
29 options.__dict__['envall']):
30 envmap = 'all'
31
32 - elif (options.__dict__.has_key('envvar') and
33 + elif ('envvar' in options.__dict__ and
34 options.__dict__['envvar']):
35 envmap = [x.lower() for x in options.__dict__['envvar']]
36
37 @@ -818,7 +818,7 @@ class Config:
38 key.lower(),
39 value)
40
41 - if (options.__dict__.has_key('define') and
42 + if ('define' in options.__dict__ and
43 options.__dict__['define']):
44 for i in options.__dict__['define']:
45 if '=' in i:
46 @@ -827,7 +827,7 @@ class Config:
47 i.split('=')[1])
48
49 # Indicate that --dir was found
50 - if options.__dict__.has_key('dir'):
51 + if 'dir' in options.__dict__:
52 self.flag_dir = True
53
54 # Map command line options into the configuration
55 @@ -845,12 +845,12 @@ class Config:
56 'bug_report' : 'g_bugreport'}
57
58 for i in option_to_config.keys():
59 - if options.__dict__.has_key(i) and options.__dict__[i]:
60 + if i in options.__dict__ and options.__dict__[i]:
61 self.config.set('USER', option_to_config[i],
62 str(options.__dict__[i]))
63
64 # handle verbosity
65 - if (options.__dict__.has_key('pretend')
66 + if ('pretend' in options.__dict__
67 and options.__dict__['pretend']):
68
69 self.config.set('USER', 'g_verbose', 'True')
70
71 diff --git a/WebappConfig/debug.py b/WebappConfig/debug.py
72 index 7c14651..c3a5c47 100644
73 --- a/WebappConfig/debug.py
74 +++ b/WebappConfig/debug.py
75 @@ -169,26 +169,26 @@ class Message:
76
77 def cli_handle(self, options):
78
79 - if (options.__dict__.has_key('debug')
80 + if ('debug' in options.__dict__
81 and options.__dict__['debug']):
82 self.debug_on()
83 else:
84 self.debug_off()
85 return
86
87 - if (options.__dict__.has_key('debug_class_vars')
88 + if ('debug_class_vars' in options.__dict__
89 and options.__dict__['debug_class_vars']):
90 self.class_variables_on()
91 else:
92 self.class_variables_off()
93
94 - if (options.__dict__.has_key('debug_nocolor')
95 + if ('debug_nocolor' in options.__dict__
96 and options.__dict__['debug_nocolor']):
97 self.color_off()
98 else:
99 self.color_on()
100
101 - if (options.__dict__.has_key('debug_level') and
102 + if ('debug_level' in options.__dict__ and
103 options.__dict__['debug_level']):
104 dbglvl = int(options.__dict__['debug_level'])
105 if dbglvl < 0:
106 @@ -197,7 +197,7 @@ class Message:
107 dbglvl = 10
108 self.set_debug_level(dbglvl)
109
110 - if (options.__dict__.has_key('debug_verbose') and
111 + if ('debug_verbose' in options.__dict__ and
112 options.__dict__['debug_verbose']):
113 dbgvrb = int(options.__dict__['debug_verbose'])
114 if dbgvrb < 1:
115 @@ -210,7 +210,7 @@ class Message:
116 ('debug_classes', self.set_debug_classes),
117 ('debug_variables', self.set_debug_variables),]:
118
119 - if (options.__dict__.has_key(i[0]) and
120 + if (i[0] in options.__dict__ and
121 options.__dict__[i[0]]):
122 i[1](options.__dict__[i[0]])
123
124
125 diff --git a/WebappConfig/dotconfig.py b/WebappConfig/dotconfig.py
126 index c9a5ba1..610d1e3 100644
127 --- a/WebappConfig/dotconfig.py
128 +++ b/WebappConfig/dotconfig.py
129 @@ -163,7 +163,7 @@ class DotConfig:
130
131 self.read()
132
133 - if self.__data.has_key('WEB_CATEGORY'):
134 + if 'WEB_CATEGORY' in self.__data:
135 OUT.notice(self.__data['WEB_CATEGORY'] + ' ' +
136 self.__data['WEB_PN'] + ' ' +
137 self.__data['WEB_PVR'])