Commit 4be9eccb authored by Barry Warsaw's avatar Barry Warsaw

getaddresses(): Like the change in rfc822.py, this one needs to access

the AddressList.addresslist attribute directly.

Also, add a test case for the email.Utils.getaddresses() interface.
parent c421ad4a
...@@ -113,7 +113,7 @@ def getaddresses(fieldvalues): ...@@ -113,7 +113,7 @@ def getaddresses(fieldvalues):
"""Return a list of (REALNAME, EMAIL) for each fieldvalue.""" """Return a list of (REALNAME, EMAIL) for each fieldvalue."""
all = COMMASPACE.join(fieldvalues) all = COMMASPACE.join(fieldvalues)
a = _AddressList(all) a = _AddressList(all)
return a.getaddrlist() return a.addresslist
......
...@@ -1235,6 +1235,13 @@ class TestMiscellaneous(unittest.TestCase): ...@@ -1235,6 +1235,13 @@ class TestMiscellaneous(unittest.TestCase):
eq(cset1, cset2) eq(cset1, cset2)
eq(cset2, cset1) eq(cset2, cset1)
def test_getaddresses(self):
eq = self.assertEqual
eq(Utils.getaddresses(['aperson@dom.ain (Al Person)',
'Bud Person <bperson@dom.ain>']),
[('Al Person', 'aperson@dom.ain'),
('Bud Person', 'bperson@dom.ain')])
# Test the iterator/generators # Test the iterator/generators
......
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