[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Import nonmember accept actions as Action.defer rather than Action.accept.
Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core Commits: 7d5fdcf5 by Mark Sapiro at 2019-05-07T20:33:19Z Import nonmember accept actions as Action.defer rather than Action.accept. - - - - - b3ed916a by Abhilash Raj at 2019-05-07T20:33:19Z Merge branch 'import' into 'master' Import nonmember accept actions as Action.defer rather than Action.accept. Closes #579 See merge request mailman/mailman!509 - - - - - 3 changed files: - src/mailman/docs/NEWS.rst - src/mailman/utilities/importer.py - src/mailman/utilities/tests/test_import.py Changes: = src/mailman/docs/NEWS.rst = @@ -29,6 +29,8 @@ Command line * The ``mailman import21`` command now leaves only regexps in the legacy ``*_these_nonmembers`` list attributes. (Closes #588) +* The ``mailman import21`` command now imports nonmember accept actions as + ``Action.defer`` rather than ``Action.accept``. (Closes #579) REST = src/mailman/utilities/importer.py = @@ -134,9 +134,10 @@ def member_moderation_action_mapping(value): def nonmember_action_mapping(value): # For default_nonmember_action, which used to be called # generic_nonmember_action, the values were: 0==Accept, 1==Hold, -# 2==Reject, 3==Discard +# 2==Reject, 3==Discard, but note that Accept is really equivalent to +# what is now defer. return { -0: Action.accept, +0: Action.defer, 1: Action.hold, 2: Action.reject, 3: Action.discard, @@ -521,6 +522,9 @@ def import_config_pck(mlist, config_dict): emails = [addr for addr in config_dict.get(prop_name, []) if not addr.startswith('^')] +# MM 2.1 accept maps to MM 3 defer +if action_name == 'accept': +action_name = 'defer' import_roster(mlist, config_dict, emails, MemberRole.nonmember, Action[action_name]) # Only keep the regexes in the legacy list property. = src/mailman/utilities/tests/test_import.py = @@ -738,7 +738,7 @@ class TestMemberActionImport(unittest.TestCase): def test_nonmember_accept(self): self._pckdict['generic_nonmember_action'] = 0 -self._do_test(dict(default_nonmember_action=Action.accept)) +self._do_test(dict(default_nonmember_action=Action.defer)) def test_nonmember_hold(self): self._pckdict['generic_nonmember_action'] = 1 @@ -1139,7 +1139,7 @@ class TestRosterImport(unittest.TestCase): def test_nonmembers(self): import_config_pck(self._mlist, self._pckdict) expected = { -'gene': Action.accept, +'gene': Action.defer, 'homer': Action.hold, 'iris': Action.reject, 'kenny': Action.discard, @@ -1151,6 +1151,9 @@ class TestRosterImport(unittest.TestCase): member = self._mlist.nonmembers.get_member( '{}@example.com'.format(name)) self.assertEqual(member.moderation_action, action) +# Action.defer maps from accept; map it back to get the name. +if action == Action.defer: +action = Action.accept # Only regexps should remain in the list property. list_prop = getattr( self._mlist, View it on GitLab: https://gitlab.com/mailman/mailman/compare/71d693654db95c3da4fff83db91b834070c3cc0a...b3ed916aa3a3ee4dda319c14762694aeaee29069 -- View it on GitLab: https://gitlab.com/mailman/mailman/compare/71d693654db95c3da4fff83db91b834070c3cc0a...b3ed916aa3a3ee4dda319c14762694aeaee29069 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
[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Remove spurious 'invalid FilterAction: discard. Treating as discard' log msg.
Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core Commits: a8abd15b by Mark Sapiro at 2019-05-07T18:48:32Z Remove spurious 'invalid FilterAction: discard. Treating as discard' log msg. - - - - - 71d69365 by Abhilash Raj at 2019-05-07T18:48:32Z Merge branch 'discard' into 'master' Remove spurious 'invalid FilterAction: discard. Treating as discard' log msg. Closes #592 See merge request mailman/mailman!507 - - - - - 3 changed files: - src/mailman/docs/NEWS.rst - src/mailman/handlers/mime_delete.py - src/mailman/handlers/tests/test_mimedel.py Changes: = src/mailman/docs/NEWS.rst = @@ -22,6 +22,8 @@ Bugs ``CC`` will now be removed from ``CC`` even if this results in no ``CC``. (Closes #575) * ``X-Mailman-Approved-At`` header now has correct timezone. (Closes #584) +* A spurious ``invalid FilterAction: discard. Treating as discard`` log + message is eliminated. (Closes #592) Command line = src/mailman/handlers/mime_delete.py = @@ -80,6 +80,8 @@ message. filebase = config.switchboards['bad'].enqueue(msg, msgdata) log.info('{} preserved in file base {}'.format( msg.get('message-id', 'n/a'), filebase)) +elif mlist.filter_action is FilterAction.discard: +pass else: log.error( '{} invalid FilterAction: {}. Treating as discard'.format( = src/mailman/handlers/tests/test_mimedel.py = @@ -103,6 +103,13 @@ Message-ID: # There should be no messages in the 'bad' queue. get_queue_messages('bad', expected_count=0) +def test_dispose_discard_no_spurious_log(self): +self._mlist.filter_action = FilterAction.discard +mark = LogFileMark('mailman.error') +with self.assertRaises(DiscardMessage): +mime_delete.dispose(self._mlist, self._msg, {}, 'discarding') +self.assertEqual(mark.readline(), '') + def test_dispose_bounce(self): self._mlist.filter_action = FilterAction.reject with self.assertRaises(RejectMessage) as cm: View it on GitLab: https://gitlab.com/mailman/mailman/compare/8e1cf75fcffca0d2e9a3abd21446416c57180df8...71d693654db95c3da4fff83db91b834070c3cc0a -- View it on GitLab: https://gitlab.com/mailman/mailman/compare/8e1cf75fcffca0d2e9a3abd21446416c57180df8...71d693654db95c3da4fff83db91b834070c3cc0a 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
[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Correct timezone in X-Mailman-Approved-At header.
Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core Commits: ff8e632c by Mark Sapiro at 2019-05-07T16:09:32Z Correct timezone in X-Mailman-Approved-At header. - - - - - 8e1cf75f by Abhilash Raj at 2019-05-07T16:09:32Z Merge branch 'approved' into 'master' Correct timezone in X-Mailman-Approved-At header. Closes #584 See merge request mailman/mailman!506 - - - - - 3 changed files: - setup.py - src/mailman/app/moderator.py - src/mailman/docs/NEWS.rst Changes: = setup.py = @@ -116,6 +116,7 @@ case second 'm'. Any other spelling is incorrect.""", 'importlib_resources', 'gunicorn', 'lazr.config', +'python-dateutil>=2.0', 'passlib', 'requests', 'sqlalchemy>=1.2.3', = src/mailman/app/moderator.py = @@ -20,6 +20,7 @@ import time import logging +from dateutil.tz import tzlocal from email.utils import formatdate, getaddresses, make_msgid from mailman.app.membership import delete_member from mailman.config import config @@ -134,7 +135,7 @@ def handle_message(mlist, id, action, comment=None, forward=None): # here can lead to a huge delay in web turnaround. Log the moderation # and add a header. msg['X-Mailman-Approved-At'] = formatdate( -time.mktime(now().timetuple()), localtime=True) +time.mktime(now(tz=tzlocal()).timetuple()), localtime=True) vlog.info('held message approved, message-id: %s', msg.get('message-id', 'n/a')) # Stick the message back in the incoming queue for further = src/mailman/docs/NEWS.rst = @@ -21,6 +21,7 @@ Bugs * A list member with ``receive_list_copy`` set to ``False`` who is addressed in ``CC`` will now be removed from ``CC`` even if this results in no ``CC``. (Closes #575) +* ``X-Mailman-Approved-At`` header now has correct timezone. (Closes #584) Command line View it on GitLab: https://gitlab.com/mailman/mailman/compare/3b18f7046edf0ef5b58f74301c0c1ef8600a0e99...8e1cf75fcffca0d2e9a3abd21446416c57180df8 -- View it on GitLab: https://gitlab.com/mailman/mailman/compare/3b18f7046edf0ef5b58f74301c0c1ef8600a0e99...8e1cf75fcffca0d2e9a3abd21446416c57180df8 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