SF bug 558179.

Change default for get() back to None.
Will backport to 2.2.1.
This commit is contained in:
Guido van Rossum 2002-06-05 19:07:39 +00:00
parent 84fca948c8
commit d842e07470
3 changed files with 2 additions and 9 deletions

View File

@ -425,13 +425,6 @@ class Message:
for i in list: for i in list:
del self.headers[i] del self.headers[i]
def get(self, name, default=""):
name = name.lower()
if name in self.dict:
return self.dict[name]
else:
return default
def setdefault(self, name, default=""): def setdefault(self, name, default=""):
lowername = name.lower() lowername = name.lower()
if lowername in self.dict: if lowername in self.dict:

View File

@ -105,7 +105,7 @@ class PyclbrTest(unittest.TestCase):
'_isfunction', '_isfunction',
'_ismodule', '_ismodule',
'_classify_class_attrs']) '_classify_class_attrs'])
self.checkModule('rfc822') self.checkModule('rfc822', ignore=["get"])
self.checkModule('difflib') self.checkModule('difflib')
def test_others(self): def test_others(self):

View File

@ -18,7 +18,7 @@ class MessageTestCase(unittest.TestCase):
'To: "last, first" <userid@foo.net>\n\ntest\n') 'To: "last, first" <userid@foo.net>\n\ntest\n')
self.assert_(msg.get("to") == '"last, first" <userid@foo.net>') self.assert_(msg.get("to") == '"last, first" <userid@foo.net>')
self.assert_(msg.get("TO") == '"last, first" <userid@foo.net>') self.assert_(msg.get("TO") == '"last, first" <userid@foo.net>')
self.assert_(msg.get("No-Such-Header") == "") self.assert_(msg.get("No-Such-Header") is None)
self.assert_(msg.get("No-Such-Header", "No-Such-Value") self.assert_(msg.get("No-Such-Header", "No-Such-Value")
== "No-Such-Value") == "No-Such-Value")