Kaydet (Commit) 81ffe75d authored tarafından Fred Drake's avatar Fred Drake

Message.__delitem__(): If the key doesn't exist in the dictionary,

        raise KeyError instead of failing silently!
üst 75ae7e7d
...@@ -397,11 +397,11 @@ class Message: ...@@ -397,11 +397,11 @@ class Message:
def __delitem__(self, name): def __delitem__(self, name):
"""Delete all occurrences of a specific header, if it is present.""" """Delete all occurrences of a specific header, if it is present."""
name = string.lower(name) lowname = string.lower(name)
if not self.dict.has_key(name): if not self.dict.has_key(lowname):
return raise KeyError, name
del self.dict[name] del self.dict[lowname]
name = name + ':' name = lowname + ':'
n = len(name) n = len(name)
list = [] list = []
hit = 0 hit = 0
......
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