diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/app/docs/hooks.rst | 1 | ||||
| -rw-r--r-- | src/mailman/app/docs/subscriptions.rst | 7 | ||||
| -rw-r--r-- | src/mailman/app/notifications.py | 1 | ||||
| -rw-r--r-- | src/mailman/app/tests/test_subscriptions.py | 12 | ||||
| -rw-r--r-- | src/mailman/chains/hold.py | 2 |
5 files changed, 14 insertions, 9 deletions
diff --git a/src/mailman/app/docs/hooks.rst b/src/mailman/app/docs/hooks.rst index 8b616f1b2..ba9bb249e 100644 --- a/src/mailman/app/docs/hooks.rst +++ b/src/mailman/app/docs/hooks.rst @@ -61,6 +61,7 @@ script that will produce no output to force the hooks to run. ... proc = subprocess.Popen( ... [exe, 'lists', '--domain', 'ignore', '-q'], ... cwd=ConfigLayer.root_directory, env=env, + ... universal_newlines=True, ... stdout=subprocess.PIPE, stderr=subprocess.PIPE) ... stdout, stderr = proc.communicate() ... assert proc.returncode == 0, stderr diff --git a/src/mailman/app/docs/subscriptions.rst b/src/mailman/app/docs/subscriptions.rst index 8c3d8b28d..eaccdc3cc 100644 --- a/src/mailman/app/docs/subscriptions.rst +++ b/src/mailman/app/docs/subscriptions.rst @@ -67,13 +67,6 @@ New members can also be added by providing an existing user id instead of an email address. However, the user must have a preferred email address. :: - >>> service.join('test.example.com', bart.user.user_id, - ... role=MemberRole.owner) - Traceback (most recent call last): - ... - MissingPreferredAddressError: User must have a preferred address: - <User "Bart Person" (2) at ...> - >>> from mailman.utilities.datetime import now >>> address = list(bart.user.addresses)[0] >>> address.verified_on = now() diff --git a/src/mailman/app/notifications.py b/src/mailman/app/notifications.py index 99cbf0d0e..f5dd7ed19 100644 --- a/src/mailman/app/notifications.py +++ b/src/mailman/app/notifications.py @@ -140,7 +140,6 @@ def send_admin_subscription_notice(mlist, address, display_name, language): """ with _.using(mlist.preferred_language.code): subject = _('$mlist.display_name subscription notification') - display_name = display_name.encode(language.charset, 'replace') text = make('adminsubscribeack.txt', mailing_list=mlist, listname=mlist.display_name, diff --git a/src/mailman/app/tests/test_subscriptions.py b/src/mailman/app/tests/test_subscriptions.py index e5aad18bc..bd1994c19 100644 --- a/src/mailman/app/tests/test_subscriptions.py +++ b/src/mailman/app/tests/test_subscriptions.py @@ -32,6 +32,7 @@ from zope.component import getUtility from mailman.app.lifecycle import create_list from mailman.interfaces.address import InvalidEmailAddressError +from mailman.interfaces.member import MemberRole, MissingPreferredAddressError from mailman.interfaces.subscriptions import ( MissingUserError, ISubscriptionService) from mailman.testing.layers import ConfigLayer @@ -57,3 +58,14 @@ class TestJoin(unittest.TestCase): with self.assertRaises(InvalidEmailAddressError) as cm: self._service.join('test.example.com', 'bogus') self.assertEqual(cm.exception.email, 'bogus') + + def test_missing_preferred_address(self): + # A user cannot join a mailing list if they have no preferred address. + anne = self._service.join( + 'test.example.com', 'anne@example.com', 'Anne Person') + # Try to join Anne as a user with a different role. Her user has no + # preferred address, so this will fail. + self.assertRaises(MissingPreferredAddressError, + self._service.join, + 'test.example.com', anne.user.user_id, + role=MemberRole.owner) diff --git a/src/mailman/chains/hold.py b/src/mailman/chains/hold.py index 1293ea266..5bb482cd5 100644 --- a/src/mailman/chains/hold.py +++ b/src/mailman/chains/hold.py @@ -157,7 +157,7 @@ class HoldChain(TerminalChainBase): if original_subject is None: original_subject = _('(no subject)') else: - original_subject = oneline(original_subject, charset) + original_subject = oneline(original_subject, in_unicode=True) substitutions = dict( listname = mlist.fqdn_listname, subject = original_subject, |
