From b2d961dcffa6602c2b39e421b157c0c0026b6c46 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Wed, 24 May 2017 13:25:26 -0700 Subject: Fix the template name of the welcome message. We did not previously complete the renaming of the templates. Rename: * user:ack:welcome -> list:user:notice:welcome * user:ack:goodbye -> list:user:notice:goodbye The new names are what are actually used in send_welcome_message() and send_goodbye_message() so the old names were actually never used. NOTE: If you added welcome or goodbye templates through REST from git head, the old names will not be used. Given that this wasn't a feature in 3.0, and the above use case is very unlikely, I've decided not to do a migration. If anybody is affected, the changes can be made manually in withlist. Closes: #337 --- src/mailman/app/tests/test_notifications.py | 5 +++-- .../alembic/versions/fa0d96e28631_template_manager.py | 4 ++-- src/mailman/database/tests/test_migrations.py | 12 ++++++------ src/mailman/rest/listconf.py | 4 ++-- src/mailman/rest/tests/test_listconf.py | 10 +++++----- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/mailman/app/tests/test_notifications.py b/src/mailman/app/tests/test_notifications.py index 05ce4cf2f..4a6f56a72 100644 --- a/src/mailman/app/tests/test_notifications.py +++ b/src/mailman/app/tests/test_notifications.py @@ -48,7 +48,8 @@ class TestNotifications(unittest.TestCase): self._mlist = create_list('test@example.com') self._mlist.display_name = 'Test List' getUtility(ITemplateManager).set( - 'user:ack:welcome', self._mlist.list_id, 'mailman:///welcome.txt') + 'list:user:notice:welcome', self._mlist.list_id, + 'mailman:///welcome.txt') config.push('template config', """\ [paths.testing] template_dir: {}/templates @@ -94,7 +95,7 @@ Welcome to the Test List mailing list. # The welcome message url can contain placeholders for the fqdn list # name and language. getUtility(ITemplateManager).set( - 'user:ack:welcome', self._mlist.list_id, + 'list:user:notice:welcome', self._mlist.list_id, 'mailman:///$listname/$language/welcome.txt') # Add the xx language and subscribe Anne using it. manager = getUtility(ILanguageManager) diff --git a/src/mailman/database/alembic/versions/fa0d96e28631_template_manager.py b/src/mailman/database/alembic/versions/fa0d96e28631_template_manager.py index 8fb8c1056..4e8fc39c6 100644 --- a/src/mailman/database/alembic/versions/fa0d96e28631_template_manager.py +++ b/src/mailman/database/alembic/versions/fa0d96e28631_template_manager.py @@ -24,9 +24,9 @@ CONVERSION_MAPPING = dict( digest_footer_uri='list:digest:footer', digest_header_uri='list:digest:header', footer_uri='list:regular:footer', - goodbye_message_uri='user:ack:goodbye', + goodbye_message_uri='list:user:notice:goodbye', header_uri='list:regular:header', - welcome_message_uri='user:ack:welcome', + welcome_message_uri='list:user:notice:welcome', ) REVERSE_MAPPING = {value: key for key, value in CONVERSION_MAPPING.items()} diff --git a/src/mailman/database/tests/test_migrations.py b/src/mailman/database/tests/test_migrations.py index cba5dbbd5..b5d17d6db 100644 --- a/src/mailman/database/tests/test_migrations.py +++ b/src/mailman/database/tests/test_migrations.py @@ -374,16 +374,16 @@ class TestMigrations(unittest.TestCase): 'list:digest:header': 'digest_header', 'list:regular:footer': 'footer', 'list:regular:header': 'header', - 'user:ack:goodbye': 'goodbye', - 'user:ack:welcome': 'welcome', + 'list:user:notice:goodbye': 'goodbye', + 'list:user:notice:welcome': 'welcome', }.get(name, name))) self.assertEqual(sorted(seen_names), [ 'list:digest:footer', 'list:digest:header', 'list:regular:footer', 'list:regular:header', - 'user:ack:goodbye', - 'user:ack:welcome', + 'list:user:notice:goodbye', + 'list:user:notice:welcome', ]) def test_fa0d96e28631_upgrade_no_uris(self): @@ -435,10 +435,10 @@ class TestMigrations(unittest.TestCase): manager.set('list:regular:header', 'ant.example.com', 'mailman:///header.txt') - manager.set('user:ack:welcome', + manager.set('list:user:notice:welcome', 'ant.example.com', 'mailman:///welcome.txt') - manager.set('user:ack:goodbye', + manager.set('list:user:notice:goodbye', 'ant.example.com', 'mailman:///goodbye.txt') mlist_table = sa.sql.table( diff --git a/src/mailman/rest/listconf.py b/src/mailman/rest/listconf.py index 87535ce48..da7111d0f 100644 --- a/src/mailman/rest/listconf.py +++ b/src/mailman/rest/listconf.py @@ -65,9 +65,9 @@ TEMPLATE_ATTRIBUTES = dict( digest_footer_uri='list:digest:footer', digest_header_uri='list:digest:header', footer_uri='list:regular:footer', - goodbye_message_uri='user:ack:goodbye', + goodbye_message_uri='list:user:notice:goodbye', header_uri='list:regular:header', - welcome_message_uri='user:ack:welcome', + welcome_message_uri='list:user:notice:welcome', ) diff --git a/src/mailman/rest/tests/test_listconf.py b/src/mailman/rest/tests/test_listconf.py index 06c138fee..782effd29 100644 --- a/src/mailman/rest/tests/test_listconf.py +++ b/src/mailman/rest/tests/test_listconf.py @@ -379,7 +379,7 @@ class TestConfiguration(unittest.TestCase): def test_get_goodbye_message_uri(self): with transaction(): getUtility(ITemplateManager).set( - 'user:ack:goodbye', self._mlist.list_id, + 'list:user:notice:goodbye', self._mlist.list_id, 'mailman:///goodbye.txt') resource, response = call_api( 'http://localhost:9001/3.0/lists/ant.example.com/config' @@ -395,7 +395,7 @@ class TestConfiguration(unittest.TestCase): self.assertEqual(response.status_code, 204) self.assertEqual( getUtility(ITemplateManager).raw( - 'user:ack:goodbye', self._mlist.list_id).uri, + 'list:user:notice:goodbye', self._mlist.list_id).uri, 'mailman:///salutation.txt') def test_patch_goodbye_message_uri(self): @@ -407,14 +407,14 @@ class TestConfiguration(unittest.TestCase): self.assertEqual(response.status_code, 204) self.assertEqual( getUtility(ITemplateManager).raw( - 'user:ack:goodbye', self._mlist.list_id).uri, + 'list:user:notice:goodbye', self._mlist.list_id).uri, 'mailman:///salutation.txt') def test_put_goodbye_message_uri(self): manager = getUtility(ITemplateManager) with transaction(): manager.set( - 'user:ack:goodbye', + 'list:user:notice:goodbye', self._mlist.list_id, 'mailman:///somefile.txt') resource, response = call_api( @@ -424,7 +424,7 @@ class TestConfiguration(unittest.TestCase): 'PUT') self.assertEqual(response.status_code, 204) self.assertEqual( - manager.raw('user:ack:goodbye', self._mlist.list_id).uri, + manager.raw('list:user:notice:goodbye', self._mlist.list_id).uri, 'mailman:///salutation.txt') def test_advertised(self): -- cgit v1.2.3-70-g09d2