Message.__delitem__(): If the key doesn't exist in the dictionary,
raise KeyError instead of failing silently!
This commit is contained in:
parent
75ae7e7dfa
commit
81ffe75d1c
|
@ -397,11 +397,11 @@ class Message:
|
|||
|
||||
def __delitem__(self, name):
|
||||
"""Delete all occurrences of a specific header, if it is present."""
|
||||
name = string.lower(name)
|
||||
if not self.dict.has_key(name):
|
||||
return
|
||||
del self.dict[name]
|
||||
name = name + ':'
|
||||
lowname = string.lower(name)
|
||||
if not self.dict.has_key(lowname):
|
||||
raise KeyError, name
|
||||
del self.dict[lowname]
|
||||
name = lowname + ':'
|
||||
n = len(name)
|
||||
list = []
|
||||
hit = 0
|
||||
|
|
Loading…
Reference in New Issue