Barry Warsaw pushed to branch master at mailman / Mailman Core
Commits: b6d78543 by Mark Sapiro at 2017-10-28T07:23:18-07:00 A list whose name is one of the subaddresses can now be posted to. - - - - - 1e9a9268 by Barry Warsaw at 2017-10-29T17:05:45+00:00 Merge branch 'subname' into 'master' A list whose name is one of the subaddresses can now be posted to. Closes #433 See merge request mailman/mailman!338 - - - - - 3 changed files: - src/mailman/docs/NEWS.rst - src/mailman/runners/lmtp.py - src/mailman/runners/tests/test_lmtp.py Changes: ===================================== src/mailman/docs/NEWS.rst ===================================== --- a/src/mailman/docs/NEWS.rst +++ b/src/mailman/docs/NEWS.rst @@ -36,6 +36,8 @@ Bugs rule. (Closes #414) * Invalid regexps in header_matches rules are properly logged and can't be set via REST. (Closes #418) +* A list whose name is one of the ``admin``, ``bounces``, ``confirm``, etc. + subaddresses can now be posted to. (Closes #433) Command line ------------ ===================================== src/mailman/runners/lmtp.py ===================================== --- a/src/mailman/runners/lmtp.py +++ b/src/mailman/runners/lmtp.py @@ -111,11 +111,8 @@ def split_recipient(address): """ localpart, domain = address.split('@', 1) localpart = localpart.split(config.mta.verp_delimiter, 1)[0] - parts = localpart.split(DASH) - if parts[-1] in SUBADDRESS_NAMES: - listname = DASH.join(parts[:-1]) - subaddress = parts[-1] - else: + listname, dash, subaddress = localpart.rpartition('-') + if subaddress not in SUBADDRESS_NAMES or listname == '' or dash == '': listname = localpart subaddress = None return listname, subaddress, domain ===================================== src/mailman/runners/tests/test_lmtp.py ===================================== --- a/src/mailman/runners/tests/test_lmtp.py +++ b/src/mailman/runners/tests/test_lmtp.py @@ -165,6 +165,38 @@ Subject: This will be recognized as a join command. get_queue_messages('in', expected_count=0) get_queue_messages('command', expected_count=1) + def test_mailing_list_with_subaddress_name(self): + # Test that we can post to a list whose name is a subaddress. + with transaction(): + create_list('j...@example.com') + self._lmtp.sendmail('a...@example.com', + ['j...@example.com'], """\ +From: a...@example.com +To: j...@example.com +Message-ID: <ant> +Subject: This will be recognized as a post to the join list. + +""") + # The message is in the incoming queue but not the command queue. + get_queue_messages('in', expected_count=1) + get_queue_messages('command', expected_count=0) + + def test_mailing_list_with_subaddress_dash_name(self): + # Test that we can post to a list whose name is -subaddress. + with transaction(): + create_list('-j...@example.com') + self._lmtp.sendmail('a...@example.com', + ['-j...@example.com'], """\ +From: a...@example.com +To: -j...@example.com +Message-ID: <ant> +Subject: This will be recognized as a post to the -join list. + +""") + # The message is in the incoming queue but not the command queue. + get_queue_messages('in', expected_count=1) + get_queue_messages('command', expected_count=0) + class TestBugs(unittest.TestCase): """Test some LMTP related bugs.""" View it on GitLab: https://gitlab.com/mailman/mailman/compare/d8ec8de8a2df0b729c46d9c1a9005c56e3999656...1e9a9268a3b8d120188e174b08b0ddc593135034 --- View it on GitLab: https://gitlab.com/mailman/mailman/compare/d8ec8de8a2df0b729c46d9c1a9005c56e3999656...1e9a9268a3b8d120188e174b08b0ddc593135034 You're receiving this email because of your account on gitlab.com.
_______________________________________________ Mailman-checkins mailing list Mailman-checkins@python.org Unsubscribe: https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org