Kaydet (Commit) 93662417 authored tarafından Guido van Rossum's avatar Guido van Rossum

More has_key() fixes.

The optparse fix is a fix to the previous fix, which broke has_option().
üst 49061f7b
...@@ -806,7 +806,7 @@ class PlaceHolder: ...@@ -806,7 +806,7 @@ class PlaceHolder:
Add the specified logger as a child of this placeholder. Add the specified logger as a child of this placeholder.
""" """
#if alogger not in self.loggers: #if alogger not in self.loggers:
if not self.loggerMap.has_key(alogger): if alogger not in self.loggerMap:
#self.loggers.append(alogger) #self.loggers.append(alogger)
self.loggerMap[alogger] = None self.loggerMap[alogger] = None
...@@ -863,7 +863,7 @@ class Manager: ...@@ -863,7 +863,7 @@ class Manager:
rv = None rv = None
_acquireLock() _acquireLock()
try: try:
if self.loggerDict.has_key(name): if name in self.loggerDict:
rv = self.loggerDict[name] rv = self.loggerDict[name]
if isinstance(rv, PlaceHolder): if isinstance(rv, PlaceHolder):
ph = rv ph = rv
...@@ -891,7 +891,7 @@ class Manager: ...@@ -891,7 +891,7 @@ class Manager:
rv = None rv = None
while (i > 0) and not rv: while (i > 0) and not rv:
substr = name[:i] substr = name[:i]
if not self.loggerDict.has_key(substr): if substr not in self.loggerDict:
self.loggerDict[substr] = PlaceHolder(alogger) self.loggerDict[substr] = PlaceHolder(alogger)
else: else:
obj = self.loggerDict[substr] obj = self.loggerDict[substr]
......
...@@ -1040,7 +1040,7 @@ class OptionContainer: ...@@ -1040,7 +1040,7 @@ class OptionContainer:
def has_option(self, opt_str): def has_option(self, opt_str):
return (opt_str in self._short_opt or return (opt_str in self._short_opt or
opt_str) in self._long_opt opt_str in self._long_opt)
def remove_option(self, opt_str): def remove_option(self, opt_str):
option = self._short_opt.get(opt_str) option = self._short_opt.get(opt_str)
......
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