Commit c441e33a authored by Barry Warsaw's avatar Barry Warsaw

* Creation of lists with upper case names should be coerced to lower case.

   (LP: #1117176)
parents ccf27cb8 755b0d51
......@@ -16,6 +16,8 @@ Bugs
----
* Non-queue runners should not create ``var/queue`` subdirectories. Fixed by
Sandesh Kumar Agrawal. (LP: #1095422)
* Creation of lists with upper case names should be coerced to lower case.
(LP: #1117176)
3.0 beta 3 -- "Here Again"
......
......@@ -45,6 +45,7 @@ class ListManager:
@dbconnection
def create(self, store, fqdn_listname):
"""See `IListManager`."""
fqdn_listname = fqdn_listname.lower()
listname, at, hostname = fqdn_listname.partition('@')
if len(hostname) == 0:
raise InvalidEmailAddressError(fqdn_listname)
......
......@@ -125,3 +125,17 @@ Message-ID: <argon>
self.assertEqual(request, None)
saved_message = getUtility(IMessageStore).get_message_by_id('<argon>')
self.assertEqual(saved_message.as_string(), msg.as_string())
class TestListCreation(unittest.TestCase):
layer = ConfigLayer
def test_create_list_case_folding(self):
# LP: #1117176 describes a problem where list names created in upper
# case are not actually usable by the LMTP server.
manager = getUtility(IListManager)
manager.create('[email protected]')
self.assertIsNone(manager.get('[email protected]'))
mlist = manager.get('[email protected]')
self.assertEqual(mlist.list_id, 'my-list.example.com')
......@@ -117,3 +117,30 @@ Message-ID: <ant>
# directory in var/queue.
queue_directory = os.path.join(config.QUEUE_DIR, 'lmtp')
self.assertFalse(os.path.isdir(queue_directory))
class TestBugs(unittest.TestCase):
"""Test some LMTP related bugs."""
layer = LMTPLayer
def setUp(self):
self._lmtp = get_lmtp_client(quiet=True)
self._lmtp.lhlo('remote.example.org')
def test_lp1117176(self):
# Upper cased list names can't be sent to via LMTP.
with transaction():
create_list('[email protected]')
self._lmtp.sendmail('[email protected]', ['[email protected]'], """\
From: [email protected]
To: [email protected]
Subject: My subject
Message-ID: <alpha>
""")
messages = get_queue_messages('in')
self.assertEqual(len(messages), 1)
self.assertEqual(messages[0].msgdata['listname'],
'[email protected]')
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