[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Add mailman/model/docs/bans.rst sourcing mailman/app/docs/bans.rst.

2021-03-21 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
20ed3641 by Mark Sapiro at 2021-03-21T12:06:20-07:00
Add mailman/model/docs/bans.rst sourcing mailman/app/docs/bans.rst.

Replaces https://gitlab.com/mailman/mailman/-/merge_requests/801
which was merged without squashing commits and without a good commit
message.

- - - - -
339c27dc by Mark Sapiro at 2021-03-21T19:33:43+00:00
Merge branch 'ban' into 'master'

Add mailman/model/docs/bans.rst sourcing mailman/app/docs/bans.rst.

Closes #442

See merge request mailman/mailman!805
- - - - -


1 changed file:

- + src/mailman/model/docs/bans.rst


Changes:

=
src/mailman/model/docs/bans.rst
=
@@ -0,0 +1 @@
+.. include:: ../../app/docs/bans.rst



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/9c7eab39d9c1b258070efb3c4ce50ebdf8c164ae...339c27dc813bf67415676b6dd703875bbd2b8fa5

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/9c7eab39d9c1b258070efb3c4ce50ebdf8c164ae...339c27dc813bf67415676b6dd703875bbd2b8fa5
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] Deleted 5 commits: ban docs created

2021-03-21 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


WARNING: The push did not contain any new commits, but force pushed to delete 
the commits and changes below.


Deleted commits:
e9d199b4 by hrs2203 at 2021-03-19T23:28:55+05:30
ban docs created

- - - - -
94bb1984 by hrs2203 at 2021-03-20T14:22:43+05:30
ban manager docs updated, #442

- - - - -
97388bae by hrs2203 at 2021-03-20T14:29:06+05:30
ban manager docs , regex updated, #442

- - - - -
3e27cd3d by hrs2203 at 2021-03-21T23:00:17+05:30
banning email address docs updated

- - - - -
b4fee5ff by Mark Sapiro at 2021-03-21T18:24:24+00:00
Merge branch 'ban_docs' into 'master'

Fixes #442

Closes #442

See merge request mailman/mailman!801
- - - - -


1 changed file:

- + src/mailman/model/docs/bans.rst


Changes:

=
src/mailman/model/docs/bans.rst
=
@@ -0,0 +1 @@
+.. include:: ../../app/docs/bans.rst



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/9c7eab39d9c1b258070efb3c4ce50ebdf8c164ae...b4fee5ffabda78c00d0c9f1e2841018f41843df2

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/9c7eab39d9c1b258070efb3c4ce50ebdf8c164ae...b4fee5ffabda78c00d0c9f1e2841018f41843df2
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 5 commits: ban docs created

2021-03-21 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
e9d199b4 by hrs2203 at 2021-03-19T23:28:55+05:30
ban docs created

- - - - -
94bb1984 by hrs2203 at 2021-03-20T14:22:43+05:30
ban manager docs updated, #442

- - - - -
97388bae by hrs2203 at 2021-03-20T14:29:06+05:30
ban manager docs , regex updated, #442

- - - - -
3e27cd3d by hrs2203 at 2021-03-21T23:00:17+05:30
banning email address docs updated

- - - - -
b4fee5ff by Mark Sapiro at 2021-03-21T18:24:24+00:00
Merge branch 'ban_docs' into 'master'

Fixes #442

Closes #442

See merge request mailman/mailman!801
- - - - -


1 changed file:

- + src/mailman/model/docs/bans.rst


Changes:

=
src/mailman/model/docs/bans.rst
=
@@ -0,0 +1 @@
+.. include:: ../../app/docs/bans.rst



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/9c7eab39d9c1b258070efb3c4ce50ebdf8c164ae...b4fee5ffabda78c00d0c9f1e2841018f41843df2

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/9c7eab39d9c1b258070efb3c4ce50ebdf8c164ae...b4fee5ffabda78c00d0c9f1e2841018f41843df2
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Add better error message for preferred email edit when not verified

2021-03-17 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
080d8802 by Shubhank Saxena at 2021-03-17T05:21:52+00:00
Add better error message for preferred email edit when not verified

Signed-off-by: Shubhank Saxena 

- - - - -
7b4160c3 by Mark Sapiro at 2021-03-17T17:50:10+00:00
Merge branch 'shubhank/set-email-improved-error' into 'master'

Add better error message for preferred email edit when not verified

Closes #706

See merge request mailman/mailman!797
- - - - -


4 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/model/tests/test_user.py
- src/mailman/model/user.py
- src/mailman/rest/docs/addresses.rst


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -49,6 +49,7 @@ New Features
 
 Other
 -
+* Add better error message for preferred email edit when not verified. (Closes 
#706)
 * Reduce the number of database calls in UserManager. (Closes #700)
 
 .. _news-3.3.3:


=
src/mailman/model/tests/test_user.py
=
@@ -105,7 +105,9 @@ class TestUser(unittest.TestCase):
 'anne.per...@example.com')
 with self.assertRaises(UnverifiedAddressError) as cm:
 self._anne.preferred_address = new_preferred
-self.assertEqual(cm.exception.address, new_preferred)
+self.assertEqual(cm.exception.address,
+ "{} must be verified before setting as primary"
+ .format(new_preferred))
 
 def test_preferences_deletion_on_user_deletion(self):
 # LP: #1418276 - deleting a user did not delete their preferences.


=
src/mailman/model/user.py
=
@@ -132,7 +132,9 @@ class User(Model):
 def preferred_address(self, address):
 """See `IUser`."""
 if address.verified_on is None:
-raise UnverifiedAddressError(address)
+raise UnverifiedAddressError(
+"{} must be verified before setting as primary".format(address)
+)
 if self.controls(address.email):
 # This user already controls the email address.
 pass


=
src/mailman/rest/docs/addresses.rst
=
@@ -406,7 +406,7 @@ Setting Ram's preferred addresses requires that it first be 
verified:
 ... {'email': 'r...@example.com'})
 Traceback (most recent call last):
 ...
-urllib.error.HTTPError: HTTP Error 400: Ram Person 
+urllib.error.HTTPError: HTTP Error 400: Ram Person  must 
be verified before setting as primary
 
 Verify Ram's address first:
 ::



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/58654b3111312dfc00e646f10e1f255bd85e7ffc...7b4160c302aa71f765a05965cfbc6a977519a772

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/58654b3111312dfc00e646f10e1f255bd85e7ffc...7b4160c302aa71f765a05965cfbc6a977519a772
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Don't log the folding from folded Message-ID headers in smtp.log.

2021-03-16 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
09545aa7 by Mark Sapiro at 2021-03-16T13:06:16-07:00
Don't log the folding from folded Message-ID headers in smtp.log.

- - - - -
58654b31 by Mark Sapiro at 2021-03-16T20:32:26+00:00
Merge branch 'smtplog' into 'master'

Don't log the folding from folded Message-ID headers in smtp.log.

Closes #844

See merge request mailman/mailman!798
- - - - -


4 changed files:

- setup.py
- src/mailman/docs/NEWS.rst
- src/mailman/mta/deliver.py
- src/mailman/mta/tests/test_delivery.py


Changes:

=
setup.py
=
@@ -127,7 +127,7 @@ case second 'm'.  Any other spelling is incorrect.""",
 'python-dateutil>=2.0',
 'passlib',
 'requests',
-'sqlalchemy>=1.2.3',
+'sqlalchemy>=1.2.3,<1.4',
 'zope.component',
 'zope.configuration',
 'zope.event',


=
src/mailman/docs/NEWS.rst
=
@@ -21,6 +21,8 @@ Bugs
   in the lmtp runner.  (Closes #836)
 * The email join command now honors the digest= option.
   (Closes #19)
+* Folded ``Message-ID`` headers no longer cause folded smtp.log messages.
+  (Closes #844)
 
 Command line
 


=
src/mailman/mta/deliver.py
=
@@ -99,7 +99,8 @@ def deliver(mlist, msg, msgdata):
 if size is None:
 size = len(msg.as_string())
 substitutions = dict(
-msgid   = msg.get('message-id', 'n/a'),   # noqa: E221,E251
+msgid   = msg.get('message-id',   # noqa: E221,E251
+  'n/a').strip(),
 listname= mlist.fqdn_listname,# noqa: E221,E251
 sender  = original_sender,# noqa: E221,E251
 recip   = len(original_recipients),   # noqa: E221,E251


=
src/mailman/mta/tests/test_delivery.py
=
@@ -29,7 +29,7 @@ from mailman.interfaces.template import ITemplateManager
 from mailman.mta.bulk import BulkDelivery
 from mailman.mta.deliver import Deliver
 from mailman.testing.helpers import (
-specialized_message_from_string as mfs, subscribe)
+LogFileMark, specialized_message_from_string as mfs, subscribe)
 from mailman.testing.layers import ConfigLayer, SMTPLayer
 from mailman.utilities.modules import find_name
 from zope.component import getUtility
@@ -357,3 +357,32 @@ Subject: test
 # Since max_sessions_per_connection is 3, sending 4 personalized
 # messages creates 2 connections.
 self.assertEqual(SMTPLayer.smtpd.get_connection_count(), 2)
+
+
+class TestDeliveryLogging(unittest.TestCase):
+"""Test that logging doesn't split on folded Message-IDs."""
+
+layer = SMTPLayer
+
+def setUp(self):
+self._mlist = create_list('t...@example.com')
+# Make Anne a member of this mailing list.
+self._anne = subscribe(self._mlist, 'Anne', email='a...@example.org')
+self._msg = mfs("""\
+From: a...@example.org
+To: t...@example.com
+Subject: test
+Message-ID:
+ 
+
+""")
+self._deliverer = find_name(config.mta.outgoing)
+
+def test_logging_with_folded_messageid(self):
+# Test that folded Message-ID header doesn't fold the log messages.
+mark = LogFileMark('mailman.smtp')
+msgdata = dict(recipients=['a...@example.org'], tolist=True)
+self._deliverer(self._mlist, self._msg, msgdata)
+logs = mark.read()
+self.assertRegex(logs, r' \(\d+\) https://gitlab.com/mailman/mailman/-/compare/b7d2493d50f5183ea8a1d9382e8fc211599e98e1...58654b3111312dfc00e646f10e1f255bd85e7ffc

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/b7d2493d50f5183ea8a1d9382e8fc211599e98e1...58654b3111312dfc00e646f10e1f255bd85e7ffc
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: The email join command now honors the digest= option.

2021-03-14 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
8a7e82a2 by Mark Sapiro at 2021-03-14T16:25:17-07:00
The email join command now honors the digest= option.

- - - - -
b7d2493d by Mark Sapiro at 2021-03-14T23:55:35+00:00
Merge branch 'join' into 'master'

The email join command now honors the digest= option.

Closes #19

See merge request mailman/mailman!796
- - - - -


4 changed files:

- src/mailman/commands/eml_membership.py
- src/mailman/commands/tests/test_eml_membership.py
- src/mailman/docs/NEWS.rst
- src/mailman/runners/tests/test_join.py


Changes:

=
src/mailman/commands/eml_membership.py
=
@@ -112,7 +112,8 @@ other than the sender of the command.
 print('Invalid email address: {}'.format(e), file=results)
 return ContinueProcessing.yes
 try:
-ISubscriptionManager(mlist).register(subscriber)
+ISubscriptionManager(mlist).register(subscriber,
+ delivery_mode=delivery_mode)
 except (AlreadySubscribedError, InvalidEmailAddressError,
 MembershipIsBannedError) as e:
 print(str(e), file=results)


=
src/mailman/commands/tests/test_eml_membership.py
=
@@ -24,6 +24,7 @@ from mailman.commands.eml_membership import Join, Leave
 from mailman.email.message import Message
 from mailman.interfaces.bans import IBanManager
 from mailman.interfaces.mailinglist import SubscriptionPolicy
+from mailman.interfaces.member import DeliveryMode
 from mailman.interfaces.pending import IPendings
 from mailman.interfaces.subscriptions import ISubscriptionManager
 from mailman.interfaces.usermanager import IUserManager
@@ -100,6 +101,24 @@ class TestJoin(unittest.TestCase):
 self.assertIn('Confirmation email sent to a...@example.com',
   str(results))
 
+def test_join_digest_works(self):
+# Subscribe a member to digest via join and verify it works.
+# Set things so the subscribe works now.
+self._mlist.subscription_policy = SubscriptionPolicy.open
+# Create a verified address for Anne.
+user = getUtility(IUserManager).make_user('a...@example.com', 'Anne')
+address = user.addresses[0]
+address.verified_on = address.registered_on
+msg = Message()
+msg['From'] = 'a...@example.com'
+results = Results()
+self._command.process(self._mlist, msg, {}, ('digest=mime',), results)
+# Anne is a member.
+members = list(self._mlist.members.members)
+self.assertEqual(1, len(members))
+self.assertEqual('a...@example.com', members[0].address.email)
+self.assertEqual(DeliveryMode.mime_digests, members[0].delivery_mode)
+
 def test_join_other(self):
 # Subscribe a different address via join.
 msg = Message()


=
src/mailman/docs/NEWS.rst
=
@@ -19,6 +19,8 @@ Bugs
 
 * Require aiosmtpd >= 1.4.1 to allow address local parts longer than 64 bytes
   in the lmtp runner.  (Closes #836)
+* The email join command now honors the digest= option.
+  (Closes #19)
 
 Command line
 


=
src/mailman/runners/tests/test_join.py
=
@@ -196,7 +196,6 @@ join digest=no
 self.assertEqual(anne.delivery_mode, DeliveryMode.regular)
 
 # LP: #1444184 - digest=mime is not currently supported.
-@unittest.expectedFailure
 def test_join_with_mime_digests(self):
 # Test the digest=mime argument to the join command.
 msg = mfs("""\
@@ -212,7 +211,6 @@ join digest=mime
 self.assertEqual(anne.delivery_mode, DeliveryMode.mime_digests)
 
 # LP: #1444184 - digest=mime is not currently supported.
-@unittest.expectedFailure
 def test_join_with_plain_digests(self):
 # Test the digest=mime argument to the join command.
 msg = mfs("""\



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/1e24fa89ddf4750993ec232b7f03afe054b39d31...b7d2493d50f5183ea8a1d9382e8fc211599e98e1

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/1e24fa89ddf4750993ec232b7f03afe054b39d31...b7d2493d50f5183ea8a1d9382e8fc211599e98e1
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Document delivery_mode and delivery_status register() args.

2021-03-14 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
beb593cb by Mark Sapiro at 2021-03-14T14:40:36-07:00
Document delivery_mode and delivery_status register() args.

- - - - -
1e24fa89 by Mark Sapiro at 2021-03-14T22:42:54+00:00
Merge branch 'iface' into 'master'

Document delivery_mode and delivery_status register() args.

See merge request mailman/mailman!795
- - - - -


1 changed file:

- src/mailman/interfaces/subscriptions.py


Changes:

=
src/mailman/interfaces/subscriptions.py
=
@@ -234,7 +234,8 @@ class ISubscriptionManager(Interface):
 """
 def register(subscriber=None, *,
  pre_verified=False, pre_confirmed=False, pre_approved=False,
- invitation=False, send_welcome_message=None):
+ invitation=False, send_welcome_message=None,
+ delivery_mode=None, delivery_status=None):
 """Subscribe an address or user according to subscription policies.
 
 The mailing list's subscription policy is used to subscribe
@@ -251,7 +252,7 @@ class ISubscriptionManager(Interface):
 resume the workflow.
 
 :param subscriber: The user or address to subscribe.
-:type email: ``IUser`` or ``IAddress``
+:type subscriber: ``IUser`` or ``IAddress``
 :param pre_verified: A flag indicating whether the subscriber's email
 address should be considered pre-verified.  Normally a never
 before seen email address must be verified by mail-back
@@ -285,6 +286,12 @@ class ISubscriptionManager(Interface):
 should receive a welcome message. This overrides the list's
 configuration of send_welcome_message if it is specified.
 :type send_welcome_message: bool
+:param delivery_mode: A ``DeliveryMode`` enum which if specified sets
+delivery_mode for the subscription.
+:type delivery_mode: ``DeliveryMode`` enum or None:
+:param delivery_status: A ``DeliveryStatus`` enum which if specified
+sets delivery_status for the subscription.
+:type delivery_status: ``DeliveryStatus`` enum or None:
 :return: A 3-tuple is returned where the first element is the token
 hash, the second element is a ``TokenOwner`, and the third element
 is the subscribed member.  If the subscriber got subscribed
@@ -315,7 +322,7 @@ class ISubscriptionManager(Interface):
 resume the workflow.
 
 :param subscriber: The user or address to unsubscribe.
-:type email: ``IUser`` or ``IAddress``
+:type subscriber: ``IUser`` or ``IAddress``
 :param pre_confirmed: A flag indicating whether, when required by the
 unsubscription policy, an unsubscription request should be
 considered pre-confirmed.  Normally in such cases, a mail-back



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/56dcb1031a16217463a18b9e9afcd0f7051cfc60...1e24fa89ddf4750993ec232b7f03afe054b39d31

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/56dcb1031a16217463a18b9e9afcd0f7051cfc60...1e24fa89ddf4750993ec232b7f03afe054b39d31
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 3 commits: Fix several grammar errors in docs

2021-03-13 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
b66f8737 by Hollow Man at 2021-03-13T20:07:14+08:00
Fix several grammar errors in docs

Signed-off-by: Hollow Man 

- - - - -
bffe00df by Songlin Jiang at 2021-03-13T16:31:36+00:00
Fix singular noun followed by plural noun in architecture.rst
- - - - -
56dcb103 by Mark Sapiro at 2021-03-13T17:17:23+00:00
Merge branch 'master' into 'master'

Fix several grammar errors in docs

See merge request mailman/mailman!793
- - - - -


4 changed files:

- src/mailman/docs/architecture.rst
- src/mailman/docs/contribute.rst
- src/mailman/docs/database.rst
- src/mailman/docs/internationalization.rst


Changes:

=
src/mailman/docs/architecture.rst
=
@@ -34,7 +34,7 @@ Users and addresses are managed by the *user manager*.
 A *member* is created by linking a *subscriber* to a mailing list.
 Subscribers can be:
 
-* A user, which become members through their *preferred address*.
+* A user, which becomes a member through their *preferred address*.
 * An address, which can be linked or unlinked to a user, but must be verified.
 
 Members also have a *role*, representing regular members, digest members, list
@@ -175,10 +175,10 @@ Other bits and pieces
 There are lots of other pieces to the Mailman puzzle, such as the set of core
 functionality (logging, initialization, event handling, etc.), mailing list
 *styles*, the API for integrating external archivers and mail servers.  The
-database layer is an critical piece, and Mailman has an extensive set of
+database layer is a critical piece, and Mailman has an extensive set of
 command line commands, and email commands.
 
-Almost the entire system is documented in these pages, but it maybe be a bit
+Almost the entire system is documented in these pages, but it may be a bit
 of a spelunking effort to find it.  Improvements are welcome!
 
 


=
src/mailman/docs/contribute.rst
=
@@ -58,7 +58,7 @@ long time, and/or require versions of Python or other 
components you might not
 have installed.  You can run ``tox -l`` to list the test suite *environments*
 available.  Very often, when you want to run the full test suite in the
 quickest manner with components that should be available everywhere, run one
-of these command, depending on which version of Python 3 you have::
+of these commands, depending on which version of Python 3 you have::
 
 $ tox -e py36-nocov
 $ tox -e py35-nocov


=
src/mailman/docs/database.rst
=
@@ -64,7 +64,7 @@ Many thanks to Stephen A. Goss for his contribution of 
PostgreSQL support.
 MySQL
 =
 
-First you need to configure MySQL itself.  Lets say you create the `mailman`
+First you need to configure MySQL itself.  Let's say you create the `mailman`
 database in MySQL via::
 
 mysql> CREATE DATABASE mailman;


=
src/mailman/docs/internationalization.rst
=
@@ -22,7 +22,7 @@ repertoire.
 Introduction to Unicode Concepts
 
 
-The Unicode Standard is intended to provide an universal set of
+The Unicode Standard is intended to provide a universal set of
 characters with a single, standard encoding providing an invertible
 mapping of characters to integers (called *code points* in this
 context).
@@ -32,7 +32,7 @@ Repertoires
 ---
 
 A set of characters is called a *repertoire*.  Unicode itself is
-intended to provide an universal repertoire sufficient to represent
+intended to provide a universal repertoire sufficient to represent
 all words in all written languages, but a system may handle a
 restricted repertoire and still be considered conformant, as long as
 it does not corrupt characters it does not handle, and does not emit



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/7f6e5c7d8eed4052e11bba26533a9e324425c2fd...56dcb1031a16217463a18b9e9afcd0f7051cfc60

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/7f6e5c7d8eed4052e11bba26533a9e324425c2fd...56dcb1031a16217463a18b9e9afcd0f7051cfc60
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Replaced 'python setup.py develop' with 'pip install -e .'.

2021-03-11 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
1d8e5feb by Mark Sapiro at 2021-03-10T22:29:18-08:00
Replaced 'python setup.py develop' with 'pip install -e .'.

- - - - -
605b993d by Mark Sapiro at 2021-03-12T01:07:44+00:00
Merge branch 'pip' into 'master'

Replaced 'python setup.py develop' with 'pip install -e .'.

See merge request mailman/mailman!792
- - - - -


2 changed files:

- src/mailman/docs/contribute.rst
- src/mailman/docs/database.rst


Changes:

=
src/mailman/docs/contribute.rst
=
@@ -127,10 +127,12 @@ into ``/tmp/mm3``::
 
 $ python3 -m venv /tmp/mm3
 
-Now, activate the virtual environment and set it up for development::
+Now, in the directory containing Mailman, activate the virtual environment
+and set it up for development::
 
-% source /tmp/mm3/bin/activate
-% python setup.py develop
+$ cd directory/containing/mailman
+$ source /tmp/mm3/bin/activate
+$ pip install -e .
 
 Sit back and have some Kombucha while you wait for everything to download and
 install.


=
src/mailman/docs/database.rst
=
@@ -99,9 +99,10 @@ something in the models, what steps are needed to reflect 
that change in the
 database schema?  You need to create and enter a virtual environment, install
 Mailman into that, and then run the ``alembic`` command.  For example::
 
+$ cd /directory/containing/mailman
 $ python3 -m venv /tmp/mm3
 $ source /tmp/mm3/bin/activate
-$ python setup.py develop
+$ pip install -e .
 $ mailman info
 $ alembic -c src/mailman/config/alembic.cfg revision --autogenerate -m
   ""



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/298710d3fe324adb66ee4698aa2e4157d2be5237...605b993d680f9fdde4e37ba363b96ec581e60782

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/298710d3fe324adb66ee4698aa2e4157d2be5237...605b993d680f9fdde4e37ba363b96ec581e60782
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Require aiosmtpd >= 1.4.1 to remove local part length restriction.

2021-03-03 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
50e3cb57 by Mark Sapiro at 2021-03-03T22:21:07-08:00
Require aiosmtpd >= 1.4.1 to remove local part length restriction.

- - - - -
298710d3 by Mark Sapiro at 2021-03-04T06:51:08+00:00
Merge branch 'lmtp' into 'master'

Require aiosmtpd >= 1.4.1 to remove local part length restriction.

Closes #836

See merge request mailman/mailman!791
- - - - -


3 changed files:

- setup.py
- src/mailman/docs/NEWS.rst
- src/mailman/runners/tests/test_lmtp.py


Changes:

=
setup.py
=
@@ -110,7 +110,7 @@ case second 'm'.  Any other spelling is incorrect.""",
 'console_scripts' : list(scripts),
 },
 install_requires = [
-'aiosmtpd>=1.1',
+'aiosmtpd>=1.4.1',
 'alembic',
 'atpublic',
 'authheaders>=0.9.2',


=
src/mailman/docs/NEWS.rst
=
@@ -15,6 +15,11 @@ Here is a history of user visible changes to Mailman.
 
 (2021-XX-XX)
 
+Bugs
+
+* Require aiosmtpd >= 1.4.1 to allow address local parts longer than 64 bytes
+  in the lmtp runner.  (Closes #836)
+
 Command line
 
 * The ``notify`` subcommand will now decode an RFC 2047 encoded Subject: for


=
src/mailman/runners/tests/test_lmtp.py
=
@@ -290,3 +290,19 @@ Message-ID: 
 """)
 items = get_queue_messages('in', expected_count=1)
 self.assertEqual(items[0].msg['message-id'], '')
+
+def test_issue_836(self):
+# Local parts > 64 bytes should be accepted.
+with transaction():
+create_list('longer_than_15_by...@example.com')
+recip = 'longer_than_15_bytes-confirm+{}@example.com'.format(40*'x')
+self._lmtp.sendmail('a...@example.com', [recip], """\
+From: a...@example.com
+To: {}
+Subject: confirm
+Message-ID: 
+
+""".format(recip))
+items = get_queue_messages('command', expected_count=1)
+self.assertEqual(items[0].msgdata['listid'],
+ 'longer_than_15_bytes.example.com')



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/3a4c08e2897aa5c714668a6479fcbad13c6ee83e...298710d3fe324adb66ee4698aa2e4157d2be5237

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/3a4c08e2897aa5c714668a6479fcbad13c6ee83e...298710d3fe324adb66ee4698aa2e4157d2be5237
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Fixed typos in mailman/handlers/docs/filtering.rst.

2021-02-25 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
5363fa64 by Mark Sapiro at 2021-02-25T19:54:52-08:00
Fixed typos in mailman/handlers/docs/filtering.rst.

- - - - -
8f4d28c1 by Mark Sapiro at 2021-02-26T04:20:32+00:00
Merge branch 'typo' into 'master'

Fixed typos in mailman/handlers/docs/filtering.rst.

See merge request mailman/mailman!787
- - - - -


1 changed file:

- src/mailman/handlers/docs/filtering.rst


Changes:

=
src/mailman/handlers/docs/filtering.rst
=
@@ -590,7 +590,7 @@ filtered to the message.  Here's a simple example.
 Name: file.pdf
 
 
-And here's a more complex one.  Note that if the filterd message in multipart,
+And here's a more complex one.  Note that if the filtered message is multipart,
 the report is attached as a separate MIME part.
 ::
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/9294f9dbbc1be079957d386b40e2d0a9033b...8f4d28c1e6ee57404a4564a3e104d1af2fcdc279

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/9294f9dbbc1be079957d386b40e2d0a9033b...8f4d28c1e6ee57404a4564a3e104d1af2fcdc279
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: RFC 2047 decode Subject: for mailman notify command.

2021-02-18 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
5a366a59 by Mark Sapiro at 2021-02-18T15:06:10-08:00
RFC 2047 decode Subject: for mailman notify command.

- - - - -
f768dd30 by Mark Sapiro at 2021-02-18T23:54:13+00:00
Merge branch 'notice' into 'master'

RFC 2047 decode Subject: for mailman notify command.

Closes #831

See merge request mailman/mailman!784
- - - - -


3 changed files:

- src/mailman/commands/cli_notify.py
- src/mailman/commands/tests/test_cli_notify.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/commands/cli_notify.py
=
@@ -20,6 +20,7 @@
 import sys
 import click
 
+from email.header import decode_header, make_header
 from mailman.core.i18n import _
 from mailman.email.message import OwnerNotification
 from mailman.interfaces.command import ICLISubCommand
@@ -120,7 +121,8 @@ def _build_detail(requestdb, subs, unsubs):
 subject = data['_mod_subject']
 reason = data['_mod_reason']
 detail += '' + _('Sender: {}\n').format(sender)
-detail += '' + _('Subject: {}\n').format(subject)
+detail += '' + _('Subject: {}\n').format(
+str(make_header(decode_header(subject
 detail += '' + _('Reason: {}\n\n').format(reason)
 return detail
 


=
src/mailman/commands/tests/test_cli_notify.py
=
@@ -52,7 +52,7 @@ Subject: message 1
 msg2 = mfs("""\
 To: a...@example.com
 From: b...@example.com
-Subject: message 2
+Subject: =?utf-8?q?message_2?=
 
 """)
 hold_message(self._mlist, msg2, {}, 'Some other reason')


=
src/mailman/docs/NEWS.rst
=
@@ -15,11 +15,15 @@ Here is a history of user visible changes to Mailman.
 
 (2021-XX-XX)
 
+Command line
+
+* The ``notify`` subcommand will now decode an RFC 2047 encoded Subject: for
+  the report of held messages.  (Closes #831)
+
 REST
 
 * Improve the speed of Members lookup via REST API. (Related to #700)
 
-
 Other
 -
 * Reduce the number of database calls in UserManager. (Closes #700)



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/5203e21a950482f8f45209ee2bd2c2f35166c275...f768dd300d0eb370a198fc3123e57a4e0ae0b298

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/5203e21a950482f8f45209ee2bd2c2f35166c275...f768dd300d0eb370a198fc3123e57a4e0ae0b298
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Update list_admin_notice_subscribe.txt

2021-02-17 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
afdacad1 by Guillermo Hernandez at 2021-02-17T09:33:13+00:00
Update list_admin_notice_subscribe.txt
- - - - -
5203e21a by Mark Sapiro at 2021-02-17T17:27:55+00:00
Merge branch 'Oldno7-master-patch-76210' into 'master'

Update list_admin_notice_subscribe.txt

See merge request mailman/mailman!782
- - - - -


1 changed file:

- src/mailman/templates/es/list_admin_notice_subscribe.txt


Changes:

=
src/mailman/templates/es/list_admin_notice_subscribe.txt
=
@@ -1,2 +1,2 @@
-$member ha sido suscrito satisfactoriamente a display_name.
+$member ha sido suscrito satisfactoriamente a $display_name.
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/02815519d53926c157a842ce1b9fc14cb62bd67a...5203e21a950482f8f45209ee2bd2c2f35166c275

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/02815519d53926c157a842ce1b9fc14cb62bd67a...5203e21a950482f8f45209ee2bd2c2f35166c275
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Test test_as_string_python_bug_27321 for Python versions where fixed.

2021-02-06 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
f6064275 by Mark Sapiro at 2021-02-06T12:36:54-08:00
Test test_as_string_python_bug_27321 for Python versions where fixed.

- - - - -
8b2a0655 by Mark Sapiro at 2021-02-06T22:42:39+00:00
Merge branch 'test' into 'master'

Test test_as_string_python_bug_27321 for Python versions where fixed.

See merge request mailman/mailman!773
- - - - -


1 changed file:

- src/mailman/email/tests/test_message.py


Changes:

=
src/mailman/email/tests/test_message.py
=
@@ -109,14 +109,25 @@ Test content
 
 def test_as_string_python_bug_27321(self):
 # Bug 27321 is fixed in Python 3.8.7rc1, 3.9.1rc1 and later.
-if (sys.version_info.minor == 8 and sys.hexversion >= 0x030807C1 or
-sys.hexversion >= 0x030901C1):
-raise unittest.SkipTest
 with path('mailman.email.tests.data', 'bad_email.eml') as email_path:
 with open(str(email_path), 'rb') as fp:
 msg = message_from_binary_file(fp, Message)
 fp.seek(0)
 text = fp.read().decode('ascii', 'replace')
+if (sys.version_info.minor == 8 and sys.hexversion >= 0x030807C1 or
+sys.hexversion >= 0x030901C1):
+self.assertEqual(msg.as_string(), """\
+To: 
+Subject: =?koi8-r?B?UF9AX/NfQ1/5X+xfS1/p?=
+From: =?koi8-r?B?8sXL0sXB1MnXzs/FIMHHxc7U09TXzw==?=
+Content-Type: text/plain; charset="koi8-r"
+Message-Id: <20160614102505.9OFQ19L1C>
+Content-Transfer-Encoding: base64
+
+/vTvIPTh6+/lIPLl6+zh7e7h8SDy4fPz+ezr4T8K68HLz8ogz9TLzMnLINbEwdTYIM/UINzUz8fP
+IM3F1M/EwSDQz8nTy8Egy8zJxc7Uz9c/Cg==
+""")
+else:
 self.assertEqual(msg.as_string(), text)
 
 def test_as_string_python_bug_32330(self):



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/45d98318c32ee339b790d0126297b302a2d5a182...8b2a06554747222c588f9a1ceb9a227f69a61135

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/45d98318c32ee339b790d0126297b302a2d5a182...8b2a06554747222c588f9a1ceb9a227f69a61135
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Skip test_as_string_python_bug_27321 for Python versions where fixed.

2021-02-05 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
70373ea1 by Mark Sapiro at 2021-02-05T20:29:42-08:00
Skip test_as_string_python_bug_27321 for Python versions where fixed.

- - - - -
45d98318 by Mark Sapiro at 2021-02-06T04:54:33+00:00
Merge branch 'test' into 'master'

Skip test_as_string_python_bug_27321 for Python versions where fixed.

Closes #823

See merge request mailman/mailman!772
- - - - -


1 changed file:

- src/mailman/email/tests/test_message.py


Changes:

=
src/mailman/email/tests/test_message.py
=
@@ -17,6 +17,7 @@
 
 """Test the message API."""
 
+import sys
 import unittest
 
 from email import message_from_binary_file
@@ -107,6 +108,10 @@ Test content
 self.assertEqual(msg.get_payload(), 'Non-ascii text ?.')
 
 def test_as_string_python_bug_27321(self):
+# Bug 27321 is fixed in Python 3.8.7rc1, 3.9.1rc1 and later.
+if (sys.version_info.minor == 8 and sys.hexversion >= 0x030807C1 or
+sys.hexversion >= 0x030901C1):
+raise unittest.SkipTest
 with path('mailman.email.tests.data', 'bad_email.eml') as email_path:
 with open(str(email_path), 'rb') as fp:
 msg = message_from_binary_file(fp, Message)



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/05a029225531daad5b6ab203df2c810af13c89d1...45d98318c32ee339b790d0126297b302a2d5a182

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/05a029225531daad5b6ab203df2c810af13c89d1...45d98318c32ee339b790d0126297b302a2d5a182
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Add __init__.py so mailman/utilities/tests/data is a package.

2021-02-04 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
5f0743ac by Mark Sapiro at 2021-02-04T18:25:48-08:00
Add __init__.py so mailman/utilities/tests/data is a package.

- - - - -
05a02922 by Mark Sapiro at 2021-02-05T03:24:22+00:00
Merge branch 'test' into 'master'

Add __init__.py so mailman/utilities/tests/data is a package.

See merge request mailman/mailman!771
- - - - -


1 changed file:

- + src/mailman/utilities/tests/data/__init__.py


Changes:

=
src/mailman/utilities/tests/data/__init__.py
=



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/1b88d8cb32ff5b0635b868e8a3abd4fcd9b43d2c...05a029225531daad5b6ab203df2c810af13c89d1

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/1b88d8cb32ff5b0635b868e8a3abd4fcd9b43d2c...05a029225531daad5b6ab203df2c810af13c89d1
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Properly parse folded ``To: list-confirm+token@...`` headers.

2021-01-28 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
333d860d by Mark Sapiro at 2021-01-28T14:12:46-08:00
Properly parse folded ``To: list-confirm+token@...`` headers.

- - - - -
c23b093d by Mark Sapiro at 2021-01-28T22:49:37+00:00
Merge branch 'conf' into 'master'

Properly parse folded ``To: list-confirm+token@...`` headers.

Closes #819

See merge request mailman/mailman!768
- - - - -


3 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/runners/command.py
- src/mailman/runners/tests/test_confirm.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -42,6 +42,8 @@ Bugs
   several API endpoinds can be very slow. (Closes #770)
 * Header filter rules are now properly processed after deletions and/or
   reordering.  (Closes #818)
+* Folded ``To: list-confirm+token@...`` headers are now parsed correctly.
+  (Closes: #819)
 
 Command line
 


=
src/mailman/runners/command.py
=
@@ -69,7 +69,9 @@ class CommandFinder:
 is_address_command = True
 self.send_response = False
 elif subaddress == 'confirm':
-mo = re.match(config.mta.verp_confirm_regexp, msg.get('to', ''))
+# match with re.DOTALL in case header is folded.
+mo = re.match(config.mta.verp_confirm_regexp,
+  msg.get('to', ''), re.DOTALL)
 if mo:
 self.command_lines.append('confirm ' + mo.group('cookie'))
 is_address_command = True


=
src/mailman/runners/tests/test_confirm.py
=
@@ -89,6 +89,28 @@ To: test-conf...@example.com
 address = manager.get_address('a...@example.org')
 self.assertEqual(address.email, 'a...@example.org')
 
+def test_confirm_with_folded_to_header(self):
+# Test that a folded To: header is properly parsed.
+msg = mfs("""\
+From: a...@example.org
+To: "test-confirm+{0}@example.com"
+ 
+Subject: Your confirmation is required ...
+
+""".format(self._token))
+self._commandq.enqueue(msg, dict(listid='test.example.com',
+ subaddress='confirm'))
+self._runner.run()
+# Anne is now a confirmed member so her user record and email address
+# should exist in the database.
+manager = getUtility(IUserManager)
+user = manager.get_user('a...@example.org')
+address = list(user.addresses)[0]
+self.assertEqual(address.email, 'a...@example.org')
+self.assertEqual(address.verified_on, datetime(2005, 8, 1, 7, 49, 23))
+address = manager.get_address('a...@example.org')
+self.assertEqual(address.email, 'a...@example.org')
+
 def test_confirm_with_utf8_body(self):
 # Clear out the virgin queue so that the test below only sees the
 # reply to the confirmation message.



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/5964768c0a7110142e4e8a992953f705beb8c250...c23b093d5b8e91059d1cffb4fb31b323e60e86aa

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/5964768c0a7110142e4e8a992953f705beb8c250...c23b093d5b8e91059d1cffb4fb31b323e60e86aa
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Added reasons to vette log discard message.

2021-01-20 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
5a25970f by Mark Sapiro at 2021-01-20T15:48:49-08:00
Added reasons to vette log discard message.

- - - - -
836a9b93 by Mark Sapiro at 2021-01-21T00:46:48+00:00
Merge branch 'discard' into 'master'

Added reasons to vette log discard message.

Closes #816

See merge request mailman/mailman!766
- - - - -


3 changed files:

- src/mailman/chains/discard.py
- + src/mailman/chains/tests/test_discard.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/chains/discard.py
=
@@ -42,6 +42,7 @@ class DiscardChain(TerminalChainBase):
 This writes a log message, fires a Zope event and then throws the
 message away.
 """
-log.info('DISCARD: %s', msg.get('message-id', 'n/a'))
+log.info('DISCARD: %s; %s', msg.get('message-id', 'n/a'),
+ msgdata.get('moderation_reasons', '[n/a]'))
 notify(DiscardEvent(mlist, msg, msgdata, self))
 # Nothing more needs to happen.


=
src/mailman/chains/tests/test_discard.py
=
@@ -0,0 +1,61 @@
+# Copyright (C) 2015-2021 by the Free Software Foundation, Inc.
+#
+# This file is part of GNU Mailman.
+#
+# GNU Mailman is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# GNU Mailman.  If not, see .
+
+"""Test the discard chain."""
+
+import unittest
+
+from mailman.app.lifecycle import create_list
+from mailman.core.chains import process as process_chain
+from mailman.testing.helpers import (
+LogFileMark, specialized_message_from_string as mfs)
+from mailman.testing.layers import ConfigLayer
+
+
+class TestDiscard(unittest.TestCase):
+"""Test the discard chain."""
+
+layer = ConfigLayer
+
+def setUp(self):
+self._mlist = create_list('t...@example.com')
+self._msg = mfs("""\
+From: a...@example.com
+To: t...@example.com
+Subject: Ignore
+Message-Id: 
+
+""")
+
+def test_discard_reasons(self):
+# The log message must contain the moderation reasons.
+msgdata = dict(moderation_reasons=['TEST-REASON-1', 'TEST-REASON-2'])
+log_file = LogFileMark('mailman.vette')
+process_chain(self._mlist, self._msg, msgdata, start_chain='discard')
+log_entry = log_file.read()
+self.assertIn('DISCARD: ', log_entry)
+self.assertIn('TEST-REASON-1', log_entry)
+self.assertIn('TEST-REASON-2', log_entry)
+
+def test_discard_no_reasons(self):
+# The log message contains n/a if no moderation reasons.
+msgdata = {}
+log_file = LogFileMark('mailman.vette')
+process_chain(self._mlist, self._msg, msgdata, start_chain='discard')
+log_entry = log_file.read()
+self.assertIn('DISCARD: ', log_entry)
+self.assertIn('[n/a]', log_entry)


=
src/mailman/docs/NEWS.rst
=
@@ -36,6 +36,8 @@ Bugs
   (Closes #809)
 * Header filters will now properly match RFC 2047 encoded headers.
   (Closes #815)
+* Mailman's ``vette`` log discard messages now include the reasons.
+  (Closes #816)
 
 Command line
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/20adbc6b5f4f812f0e87086fb67f3066bc279935...836a9b93f71e9d25449f66ae5b57406d1f3252f6

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/20adbc6b5f4f812f0e87086fb67f3066bc279935...836a9b93f71e9d25449f66ae5b57406d1f3252f6
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Add more i18n. Fix missing word in findmember.rst.

2021-01-16 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
8e5db5b3 by Mark Sapiro at 2021-01-16T15:23:54-08:00
Add more i18n. Fix missing word in findmember.rst.

- - - - -
1987828a by Mark Sapiro at 2021-01-17T00:24:38+00:00
Merge branch 'find' into 'master'

Add more i18n. Fix missing word in findmember.rst.

See merge request mailman/mailman!762
- - - - -


3 changed files:

- src/mailman/commands/cli_findmember.py
- src/mailman/commands/docs/findmember.rst
- src/mailman/commands/tests/test_cli_findmember.py


Changes:

=
src/mailman/commands/cli_findmember.py
=
@@ -95,14 +95,14 @@ def findmember(ctx, role, pattern):
 email = _get_member_email(member)
 if email != last_email:
 last_list_id = last_role = ''
-print('Email: {}'.format(email))
+print(_('Email: {}').format(email))
 last_email = email
 if member.list_id != last_list_id:
 last_role = ''
-print('List: {}'.format(member.list_id))
+print(' '*4 + _('List: {}').format(member.list_id))
 last_list_id = member.list_id
 if member.role != last_role:
-print('{}'.format(str(member.role)))
+print(' '*8 + _('{}').format(str(member.role)))
 last_role = member.role
 
 


=
src/mailman/commands/docs/findmember.rst
=
@@ -2,8 +2,8 @@
 Finding members
 ===
 
-The ``mailman findmember`` reports all members with email address matching a
-case-insensitive supplied pattern by address, list and role.
+The ``mailman findmember`` command reports all members with email address
+matching a case-insensitive supplied pattern by address, list and role.
 
 >>> from mailman.testing.documentation import cli
 >>> command = cli('mailman.commands.cli_findmember.findmember')


=
src/mailman/commands/tests/test_cli_findmember.py
=
@@ -40,11 +40,11 @@ class TestCLIFindMember(unittest.TestCase):
 subscribe(self._mlist, 'Anne')
 result = self._command.invoke(findmember, ('.',))
 self.assertEqual(result.exit_code, 0)
-self.assertEqual(
-result.output,
-'Email: aper...@example.com\n'
-'List: ant.example.com\n'
-'MemberRole.member\n')
+self.assertEqual(result.output, """\
+Email: aper...@example.com
+List: ant.example.com
+MemberRole.member
+""")
 
 def test_no_role(self):
 # Test for no matching roles.
@@ -65,11 +65,11 @@ class TestCLIFindMember(unittest.TestCase):
 subscribe(self._mlist, 'Anne')
 result = self._command.invoke(findmember, ('APerson',))
 self.assertEqual(result.exit_code, 0)
-self.assertEqual(
-result.output,
-'Email: aper...@example.com\n'
-'List: ant.example.com\n'
-'MemberRole.member\n')
+self.assertEqual(result.output, """\
+Email: aper...@example.com
+List: ant.example.com
+MemberRole.member
+""")
 
 def test_user_and_address(self):
 # Test finding members subscribed as user and as address.
@@ -77,14 +77,14 @@ class TestCLIFindMember(unittest.TestCase):
 subscribe(self._mlistb, 'Bart', as_user=False)
 result = self._command.invoke(findmember, ('.'))
 self.assertEqual(result.exit_code, 0)
-self.assertEqual(
-result.output,
-'Email: aper...@example.com\n'
-'List: ant.example.com\n'
-'MemberRole.member\n'
-'Email: bper...@example.com\n'
-'List: bee.example.com\n'
-'MemberRole.member\n')
+self.assertEqual(result.output, """\
+Email: aper...@example.com
+List: ant.example.com
+MemberRole.member
+Email: bper...@example.com
+List: bee.example.com
+MemberRole.member
+""")
 
 def test_only_role(self):
 # Test only finding requested role.
@@ -92,11 +92,11 @@ class TestCLIFindMember(unittest.TestCase):
 subscribe(self._mlistb, 'Bart', role=MemberRole.owner)
 result = self._command.invoke(findmember, ('--role', 'owner', '.'))
 self.assertEqual(result.exit_code, 0)
-self.assertEqual(
-result.output,
-'Email: bper...@example.com\n'
-'List: bee.example.com\n'
-'MemberRole.owner\n')
+self.assertEqual(result.output, """\
+Email: bper...@example.com
+List: bee.example.com
+MemberRole.owner
+""")
 
 def test_find_only_admins(self):
 # Test the administrators role.
@@ -108,11 +108,11 @@ class TestCLIFindMember(unittest.TestCase):
'administrator',
   

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Minor formatting change.

2021-01-15 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
357ebb44 by Mark Sapiro at 2021-01-15T21:05:42-08:00
Minor formatting change.

- - - - -
70ab130c by Mark Sapiro at 2021-01-16T05:27:08+00:00
Merge branch 'doc' into 'master'

Minor formatting change.

See merge request mailman/mailman!760
- - - - -


1 changed file:

- src/mailman/commands/docs/findmember.rst


Changes:

=
src/mailman/commands/docs/findmember.rst
=
@@ -81,7 +81,8 @@ with various roles.
  on b...@example.com
  as MemberRole.member>
 
-First, use a pattern of ``person`` and no --role to get all members and roles.
+First, use a pattern of ``person`` and no ``--role`` option to get all members
+and roles.
 ::
 
 >>> command('mailman findmember person')



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/3066edc3679e7497efd74753778710d7fa976542...70ab130c11d91e4ca81e638fc2c9a108d520f4ce

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/3066edc3679e7497efd74753778710d7fa976542...70ab130c11d91e4ca81e638fc2c9a108d520f4ce
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: RFC 2047 decode headers for header filters.

2021-01-14 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
cbf5584f by Mark Sapiro at 2021-01-14T21:11:30-08:00
RFC 2047 decode headers for header filters.

- - - - -
3066edc3 by Mark Sapiro at 2021-01-15T05:35:00+00:00
Merge branch 'match' into 'master'

RFC 2047 decode headers for header filters.

Closes #815

See merge request mailman/mailman!759
- - - - -


3 changed files:

- src/mailman/chains/headers.py
- src/mailman/chains/tests/test_headers.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/chains/headers.py
=
@@ -20,7 +20,7 @@
 import re
 import logging
 
-from email.header import Header
+from email.header import Header, decode_header, make_header
 from itertools import count
 from mailman.chains.base import Chain, Link
 from mailman.config import config
@@ -104,8 +104,10 @@ class HeaderMatchRule:
 for value in headers:
 if isinstance(value, Header):
 value = value.encode()
+# RFC2047 decode, but don't change value as it affects the msg.
+new_value = str(make_header(decode_header(value)))
 try:
-mo = re.search(self.pattern, value, re.IGNORECASE)
+mo = re.search(self.pattern, new_value, re.IGNORECASE)
 except re.error as error:
 log.error(
 "Invalid regexp '{}' in header_matches for {}: {}".format(


=
src/mailman/chains/tests/test_headers.py
=
@@ -240,6 +240,30 @@ This is junk
 self.assertIsInstance(event, HoldEvent)
 self.assertEqual(event.chain, config.chains['hold'])
 
+def test_rfc2047_encodedheader(self):
+# Test case where msg.get_all() returns raw rfc2047 encoded string.
+msg = message_from_bytes(b"""\
+From: a...@example.com
+To: t...@example.com
+Subject: =?utf-8?b?SSBsaWtlIElrZQo=?=
+Message-ID: 
+
+body
+
+""", Message)
+msgdata = {}
+header_matches = IHeaderMatchList(self._mlist)
+header_matches.append('Subject', 'I Like Ike', 'hold')
+# This event subscriber records the event that occurs when the message
+# is processed by the owner chain.
+events = []
+with event_subscribers(events.append):
+process(self._mlist, msg, msgdata, start_chain='header-match')
+self.assertEqual(len(events), 1)
+event = events[0]
+self.assertIsInstance(event, HoldEvent)
+self.assertEqual(event.chain, config.chains['hold'])
+
 def test_get_all_returns_non_string(self):
 # Test case where msg.get_all() returns header instance.
 msg = message_from_bytes(b"""\


=
src/mailman/docs/NEWS.rst
=
@@ -34,6 +34,8 @@ Bugs
   ``SubscriptionPendingError``.  (Closes #805)
 * RFC 2369 ``List-Owner`` header is now added when these headers are included.
   (Closes #809)
+* Header filters will now properly match RFC 2047 encoded headers.
+  (Closes #815)
 
 Command line
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/e29aa652ef2c8088b3ca626ba33626487604ba5d...3066edc3679e7497efd74753778710d7fa976542

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/e29aa652ef2c8088b3ca626ba33626487604ba5d...3066edc3679e7497efd74753778710d7fa976542
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Add RFC 2369 List-Owner header.

2020-12-30 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
6f9761f3 by Mark Sapiro at 2020-12-30T11:06:23-08:00
Add RFC 2369 List-Owner header.

- - - - -
d1185327 by Mark Sapiro at 2020-12-30T19:30:40+00:00
Merge branch 'owner' into 'master'

Add RFC 2369 List-Owner header.

Closes #809

See merge request mailman/mailman!753
- - - - -


5 changed files:

- src/mailman/app/docs/pipelines.rst
- src/mailman/docs/NEWS.rst
- src/mailman/handlers/docs/rfc-2369.rst
- src/mailman/handlers/rfc_2369.py
- src/mailman/handlers/tests/test_rfc_2369.py


Changes:

=
src/mailman/app/docs/pipelines.rst
=
@@ -55,6 +55,7 @@ come later during delivery).
 Archived-At: 
 List-Archive: 
 List-Help: 
+List-Owner: 
 List-Post: 
 List-Subscribe: 
 List-Unsubscribe: 


=
src/mailman/docs/NEWS.rst
=
@@ -32,6 +32,8 @@ Bugs
   (Closes #802)
 * The ``mailman addmembers`` command now catches and reports a
   ``SubscriptionPendingError``.  (Closes #805)
+* RFC 2369 ``List-Owner`` header is now added when these headers are included.
+  (Closes #809)
 
 New Features
 


=
src/mailman/handlers/docs/rfc-2369.rst
=
@@ -75,6 +75,7 @@ have a reduced set of `List-` headers.  Specifically, there 
is no `List-Post`,
 ---start---
 list-help: 
 list-id: 
+list-owner: 
 list-subscribe: 
 list-unsubscribe: 
 ---end---
@@ -97,6 +98,7 @@ header which contains the `mailto:` URL used to send messages 
to the list.
 ---start---
 list-help: 
 list-id: 
+list-owner: 
 list-post: 
 list-subscribe: 
 list-unsubscribe: 
@@ -117,6 +119,7 @@ to RFC 2369.
 ---start---
 list-help: 
 list-id: 
+list-owner: 
 list-post: NO
 list-subscribe: 
 list-unsubscribe: 
@@ -140,6 +143,7 @@ header.
 ---start---
 list-help: 
 list-id: My test mailing list 
+list-owner: 
 list-post: 
 list-subscribe: 
 list-unsubscribe: 


=
src/mailman/handlers/rfc_2369.py
=
@@ -64,6 +64,7 @@ def process(mlist, msg, msgdata):
 # suppressed).
 headers.extend((
 ('List-Help', ''.format(requestaddr)),
+('List-Owner', ''.format(mlist.owner_address)),
 ('List-Unsubscribe', ''.format(mlist.leave_address)),
 ('List-Subscribe', ''.format(mlist.join_address)),
 ))


=
src/mailman/handlers/tests/test_rfc_2369.py
=
@@ -154,3 +154,29 @@ Dummy text
 self.assertIsNone(self._msg.get('archived-at'))
 self.assertIn('Exception in "broken" archiver', log_messages)
 self.assertIn('RuntimeError: Cannot get permalink', log_messages)
+
+def test_add_other_headers(self):
+# Test that other RFC-2369 headers are added.
+self._mlist.include_rfc2369_headers = True
+rfc_2369.process(self._mlist, self._msg, {})
+self.assertEqual(
+self._msg.get_all('List-Help'),
+[''.format(self._mlist.request_address)])
+self.assertEqual(
+self._msg.get_all('List-Owner'),
+[''.format(self._mlist.owner_address)])
+self.assertEqual(
+self._msg.get_all('List-Unsubscribe'),
+[''.format(self._mlist.leave_address)])
+self.assertEqual(
+self._msg.get_all('List-Subscribe'),
+[''.format(self._mlist.join_address)])
+
+def test_dont_add_other_headers(self):
+# Test that other RFC-2369 headers are not added if not requested.
+self._mlist.include_rfc2369_headers = False
+rfc_2369.process(self._mlist, self._msg, {})
+self.assertIsNone(self._msg.get_all('List-Help'))
+self.assertIsNone(self._msg.get_all(

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Catch SubscriptionPendingError in mailman addmembers.

2020-12-18 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
a32ed9f4 by Mark Sapiro at 2020-12-18T10:07:14-08:00
Catch SubscriptionPendingError in mailman addmembers.

- - - - -
bbb0e944 by Mark Sapiro at 2020-12-18T18:32:19+00:00
Merge branch 'addmemb' into 'master'

Catch SubscriptionPendingError in mailman addmembers.

Closes #805

See merge request mailman/mailman!751
- - - - -


3 changed files:

- src/mailman/commands/cli_addmembers.py
- src/mailman/commands/tests/test_cli_addmembers.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/commands/cli_addmembers.py
=
@@ -29,7 +29,8 @@ from mailman.interfaces.listmanager import IListManager
 from mailman.interfaces.member import (
 AlreadySubscribedError, DeliveryMode, DeliveryStatus,
 MembershipIsBannedError)
-from mailman.interfaces.subscriptions import ISubscriptionManager
+from mailman.interfaces.subscriptions import (ISubscriptionManager,
+  SubscriptionPendingError)
 from mailman.interfaces.usermanager import IUserManager
 from mailman.utilities.options import I18nCommand
 from public import public
@@ -99,6 +100,9 @@ def add_members(mlist, in_fp, delivery, invite, welcome_msg):
 except MembershipIsBannedError:
 print(_('Membership is banned (skipping): $email'),
   file=sys.stderr)
+except SubscriptionPendingError:
+print(_('Subscription already pending (skipping): $email'),
+  file=sys.stderr)
 
 
 @click.command(


=
src/mailman/commands/tests/test_cli_addmembers.py
=
@@ -24,7 +24,9 @@ from click.testing import CliRunner
 from mailman.app.lifecycle import create_list
 from mailman.commands.cli_addmembers import addmembers
 from mailman.interfaces.bans import IBanManager
+from mailman.interfaces.mailinglist import SubscriptionPolicy
 from mailman.interfaces.member import DeliveryMode, DeliveryStatus, MemberRole
+from mailman.interfaces.subscriptions import ISubscriptionManager
 from mailman.interfaces.usermanager import IUserManager
 from mailman.testing.helpers import get_queue_messages, subscribe
 from mailman.testing.layers import ConfigLayer
@@ -82,6 +84,24 @@ class TestCLIAddMembers(unittest.TestCase):
)
 self.assertEqual(len(list(self._mlist.members.members)), 0)
 
+def test_subscription_pending(self):
+# Create an address.
+address = getUtility(IUserManager).create_address(
+'aper...@example.com', 'Anne Person')
+# Pend a subscription.
+self._mlist.subscription_policy = SubscriptionPolicy.confirm
+ISubscriptionManager(self._mlist).register(address)
+with NamedTemporaryFile('w', buffering=1, encoding='utf-8') as infp:
+print('Anne Person ', file=infp)
+result = self._command.invoke(addmembers, (
+infp.name, 'ant.example.com'))
+self.assertEqual(
+   result.output,
+   'Subscription already pending (skipping): '
+   'Anne Person \n'
+   )
+self.assertEqual(len(list(self._mlist.members.members)), 0)
+
 def test_add_invalid_email(self):
 with NamedTemporaryFile('w', buffering=1, encoding='utf-8') as infp:
 print('foobar@', file=infp)


=
src/mailman/docs/NEWS.rst
=
@@ -30,6 +30,8 @@ Bugs
 * A bounce for a non-existent list is now handled.  (Closes #799)
 * RFC 2047 From: headers in emailed ``join`` commands are now decoded.
   (Closes #802)
+* The ``mailman addmembers`` command now catches and reports a
+  ``SubscriptionPendingError``.  (Closes #805)
 
 New Features
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/ca081d003d7166d6d4f71d3fcea3d10832b7b409...bbb0e94461d966b14f2e0b236944e28e7843b6dd

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/ca081d003d7166d6d4f71d3fcea3d10832b7b409...bbb0e94461d966b14f2e0b236944e28e7843b6dd
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: RFC 2047 decode From: in mail to -join.

2020-12-14 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
c4b32ed5 by Mark Sapiro at 2020-12-14T12:26:09-08:00
RFC 2047 decode From: in mail to -join.

- - - - -
51131e37 by Mark Sapiro at 2020-12-14T20:49:26+00:00
Merge branch 'join' into 'master'

RFC 2047 decode From: in mail to -join.

Closes #802

See merge request mailman/mailman!745
- - - - -


3 changed files:

- src/mailman/commands/eml_membership.py
- src/mailman/commands/tests/test_eml_membership.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/commands/eml_membership.py
=
@@ -17,6 +17,7 @@
 
 """The email commands 'join' and 'subscribe'."""
 
+from email.header import decode_header, make_header
 from email.utils import formataddr, parseaddr
 from mailman.core.i18n import _
 from mailman.interfaces.address import InvalidEmailAddressError
@@ -79,7 +80,12 @@ other than the sender of the command.
 if delivery_mode is ContinueProcessing.no:
 return ContinueProcessing.no
 if not address:
-display_name, email = parseaddr(msg['from'])
+# RFC 2047 decode the From: header.
+if msg['from'] is None:
+display_name, email = ('', '')
+else:
+decoded_from = str(make_header(decode_header(msg['from'])))
+display_name, email = parseaddr(decoded_from)
 else:
 display_name, email = ('', address)
 # Address could be None or the empty string.


=
src/mailman/commands/tests/test_eml_membership.py
=
@@ -24,6 +24,7 @@ from mailman.commands.eml_membership import Join, Leave
 from mailman.email.message import Message
 from mailman.interfaces.bans import IBanManager
 from mailman.interfaces.mailinglist import SubscriptionPolicy
+from mailman.interfaces.pending import IPendings
 from mailman.interfaces.subscriptions import ISubscriptionManager
 from mailman.interfaces.usermanager import IUserManager
 from mailman.runners.command import Results
@@ -72,6 +73,24 @@ class TestJoin(unittest.TestCase):
 self.assertIn('Confirmation email sent to a...@example.com',
   str(results))
 
+def test_join_rfc2047_display(self):
+# Subscribe a member with RFC 2047 encoded display name via join.
+msg = Message()
+msg['From'] = '=?utf-8?q?Anne?= '
+results = Results()
+self._command.process(self._mlist, msg, {}, (), results)
+self.assertIn('Confirmation email sent to Anne ',
+  str(results))
+# Check the pending confirmation.
+pendings = list(getUtility(IPendings).find(self._mlist,
+   'subscription',
+   confirm=False))
+self.assertEqual(1, len(pendings))
+token = pendings[0][0]
+pended = getUtility(IPendings).confirm(token, expunge=False)
+self.assertEqual('Anne', pended['display_name'])
+self.assertEqual('a...@example.com', pended['email'])
+
 def test_join_digest(self):
 # Subscribe a member to digest via join.
 msg = Message()


=
src/mailman/docs/NEWS.rst
=
@@ -28,6 +28,8 @@ Bugs
 * Fixed an issue where content filtering can throw UnicodeEncodeError when
   converting HTML to plain text.  (Closes #798)
 * A bounce for a non-existent list is now handled.  (Closes #799)
+* RFC 2047 From: headers in emailed ``join`` commands are now decoded.
+  (Closes #802)
 
 New Features
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/99942b84d54d467324ad1409eeb9b665b772869c...51131e376de6c6c14ad64dc0713f485c2b28f0f6

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/99942b84d54d467324ad1409eeb9b665b772869c...51131e376de6c6c14ad64dc0713f485c2b28f0f6
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Recommend charset=utf8mb4 for MySQL.

2020-12-09 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
e6e0a10a by Mark Sapiro at 2020-12-09T20:21:23-08:00
Recommend charset=utf8mb4 for MySQL.

- - - - -
99942b84 by Mark Sapiro at 2020-12-10T04:43:14+00:00
Merge branch 'doc' into 'master'

Recommend charset=utf8mb4 for MySQL.

See merge request mailman/mailman!744
- - - - -


1 changed file:

- src/mailman/docs/database.rst


Changes:

=
src/mailman/docs/database.rst
=
@@ -78,7 +78,7 @@ You would then need to set both the `class` and `url` 
variables in
 
 [database]
 class: mailman.database.mysql.MySQLDatabase
-url: 
mysql+pymysql://myuser:mypassword@mymysqlhost/mailman?charset=utf8&use_unicode=1
+url: 
mysql+pymysql://myuser:mypassword@mymysqlhost/mailman?charset=utf8mb4&use_unicode=1
 
 The last part of the url specifies the charset that client expects from the
 server and to use Unicode via the flag `use_unicode`.  You can find more about



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/b100cd2be28ad55fe1ad7d9d12775a0ad4a3b4e9...99942b84d54d467324ad1409eeb9b665b772869c

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/b100cd2be28ad55fe1ad7d9d12775a0ad4a3b4e9...99942b84d54d467324ad1409eeb9b665b772869c
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Handle a bounce for a non-existent list.

2020-12-08 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
40dd0a4d by Mark Sapiro at 2020-12-08T21:46:45-08:00
Handle a bounce for a non-existent list.

- - - - -
b100cd2b by Mark Sapiro at 2020-12-09T06:26:27+00:00
Merge branch 'bounce' into 'master'

Handle a bounce for a non-existent list.

Closes #799

See merge request mailman/mailman!743
- - - - -


3 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/model/bounce.py
- src/mailman/model/tests/test_bounce.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -27,6 +27,7 @@ Bugs
   parent directory present.  (Closes #699)
 * Fixed an issue where content filtering can throw UnicodeEncodeError when
   converting HTML to plain text.  (Closes #798)
+* A bounce for a non-existent list is now handled.  (Closes #799)
 
 New Features
 


=
src/mailman/model/bounce.py
=
@@ -124,6 +124,13 @@ class BounceProcessor:
 """See `IBounceProcessor`."""
 list_manager = getUtility(IListManager)
 mlist = list_manager.get(event.list_id)
+if mlist is None:
+# List was removed before the bounce is processed.
+event.processed = True
+# This needs an explicit commit because of the raise.
+config.db.commit()
+raise InvalidBounceEvent(
+'Bounce for non-existent list {}'.format(event.list_id))
 member = mlist.members.get_member(event.email)
 if member is None:
 event.processed = True


=
src/mailman/model/tests/test_bounce.py
=
@@ -20,7 +20,7 @@
 import unittest
 
 from datetime import datetime, timedelta
-from mailman.app.lifecycle import create_list
+from mailman.app.lifecycle import create_list, remove_list
 from mailman.database.transaction import transaction
 from mailman.interfaces.bounce import (
 BounceContext, IBounceProcessor, InvalidBounceEvent)
@@ -138,6 +138,18 @@ Message-Id: 
 # Also, the delivery should be unset, the default.
 self.assertIsNone(member.preferences.delivery_status)
 
+# Now create another event for Anne.
+self._subscribe_and_add_bounce_event('a...@example.com', create=False,
+ subscribe=False)
+# Now delete the list and process the bounce for the non-existent list.
+remove_list(self._mlist)
+events = list(self._processor.unprocessed)
+self.assertEqual(len(events), 1)
+# If the MailingList has been deleted, an InvalidBounceEvent exception
+# is raised.
+with self.assertRaises(InvalidBounceEvent):
+self._processor.process_event(events[0])
+
 def test_bounce_score_increases_once_everyday(self):
 # Test only the bounce events more than a day apart can increase the
 # bounce score of a member.



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/45edbcb884ac9198d42f06833ea381585a72b68d...b100cd2be28ad55fe1ad7d9d12775a0ad4a3b4e9

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/45edbcb884ac9198d42f06833ea381585a72b68d...b100cd2be28ad55fe1ad7d9d12775a0ad4a3b4e9
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Fix issue converting non-ascii html to plain text.

2020-12-04 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
e5f3f118 by Mark Sapiro at 2020-12-04T09:52:50+00:00
Fix issue converting non-ascii html to plain text.

- - - - -
45edbcb8 by Mark Sapiro at 2020-12-04T09:52:50+00:00
Merge branch 'mimedel' into 'master'

Fix issue converting non-ascii html to plain text.

Closes #798

See merge request mailman/mailman!742
- - - - -


4 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/handlers/mime_delete.py
- + src/mailman/handlers/tests/data/html_to_plain.eml
- src/mailman/handlers/tests/test_mimedel.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -23,8 +23,10 @@ Bugs
 * Implemented a ``scrubber`` for plain text digests.  (Closes #473)
 * The ``mailman gatenews`` command now adds ``original_size`` as a message
   attribute.  (Extends fix for #762)
-* Handle FileNotFoundError when creating digest.mmdf file without
-  parent directory present (Closes #699)
+* Handle FileNotFoundError when creating digest.mmdf file without a
+  parent directory present.  (Closes #699)
+* Fixed an issue where content filtering can throw UnicodeEncodeError when
+  converting HTML to plain text.  (Closes #798)
 
 New Features
 


=
src/mailman/handlers/mime_delete.py
=
@@ -277,9 +277,9 @@ def to_plaintext(msg):
 resources.callback(shutil.rmtree, tempdir)
 for subpart in typed_subpart_iterator(msg, 'text', 'html'):
 filename = os.path.join(tempdir, '{}.html'.format(next(counter)))
-ctype = msg.get_content_charset('us-ascii')
+cset = subpart.get_content_charset('us-ascii')
 with open(filename, 'w', encoding='utf-8') as fp:
-fp.write(subpart.get_payload(decode=True).decode(ctype,
+fp.write(subpart.get_payload(decode=True).decode(cset,
  errors='replace'))
 template = Template(config.mailman.html_to_plain_text_command)
 command = template.safe_substitute(filename=filename).split()
@@ -291,7 +291,7 @@ def to_plaintext(msg):
 # Replace the payload of the subpart with the converted text
 # and tweak the content type.
 del subpart['content-transfer-encoding']
-subpart.set_payload(stdout, charset=ctype)
+subpart.set_payload(stdout, charset=cset)
 subpart.set_type('text/plain')
 changedp += 1
 return changedp


=
src/mailman/handlers/tests/data/html_to_plain.eml
=
@@ -0,0 +1,25 @@
+To: l...@example.com
+From: u...@example.com
+Subject: Test Message
+Message-ID: 
+Date: Thu, 3 Dec 2020 15:18:27 +0100
+MIME-Version: 1.0
+Content-Type: multipart/mixed;
+ boundary="04218E0A720FDBFA6DB11AF1"
+
+--04218E0A720FDBFA6DB11AF1
+Content-Type: text/plain; charset=utf-8; format=flowed
+Content-Transfer-Encoding: quoted-printable
+
+This is a plain text body
+
+--04218E0A720FDBFA6DB11AF1
+Content-Type: text/html; charset=UTF-8;
+ name="junk.html"
+Content-Disposition: attachment;
+ filename="junk.html"
+Content-Transfer-Encoding: base64
+
+VW0gZnLDvGhlcmUgTmFjaHJpY2h0ZW4K
+
+--04218E0A720FDBFA6DB11AF1--


=
src/mailman/handlers/tests/test_mimedel.py
=
@@ -351,6 +351,22 @@ MIME-Version: 1.0
 payload_lines = msg.get_payload().splitlines()
 self.assertEqual(payload_lines[0], '')
 
+def test_html_part_with_non_ascii(self):
+# Ensure we can convert HTML to plain text in an HTML sub-part which
+# contains non-ascii.
+with resource_open(
+'mailman.handlers.tests.data',
+'html_to_plain.eml') as fp:
+msg = email.message_from_binary_file(fp)
+process = config.handlers['mime-delete'].process
+with dummy_script():
+process(self._mlist, msg, {})
+part = msg.get_payload(1)
+cset = part.get_content_charset('us-ascii')
+text = part.get_payload(decode=True).decode(cset).splitlines()
+self.assertEqual(text[0], 'Converted text/html to text/plain')
+self.assertEqual(text[2], 'Um frühere Nachrichten')
+
 
 class TestMiscellaneous(unittest.TestCase):
 """Test various miscellaneous filtering actions."""



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/9176bf6ee3fa8c707e8a60aeca495e799c07e216...45edbcb884ac9198d42f06833ea381585a72b68d

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/9176bf6ee3fa8c707e8a60aeca495e799c07e216...45edbcb884ac9198d42f06833ea381585a72b68d
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list --

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Fix scrubber to not reference non-existent payload.

2020-12-03 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
9132d1f3 by Mark Sapiro at 2020-12-03T21:17:35-08:00
Fix scrubber to not reference non-existent payload.

- - - - -
9176bf6e by Mark Sapiro at 2020-12-04T05:59:41+00:00
Merge branch 'scrub' into 'master'

Fix scrubber to not reference non-existent payload.

See merge request mailman/mailman!741
- - - - -


2 changed files:

- src/mailman/utilities/scrubber.py
- src/mailman/utilities/tests/test_scrubber.py


Changes:

=
src/mailman/utilities/scrubber.py
=
@@ -43,7 +43,7 @@ def scrub(msg):
 # Unknown or empty charset.
 payload = payload.decode('us-ascii', 'replace')
 else:
-size = len(payload) # noqa: F841
+size = len(part.get_payload(decode=True))   # noqa: F841
 desc = part.get('content-description',  # noqa: F841
 _('not available'))
 filename = part.get_filename(_('not available'))# noqa: F841


=
src/mailman/utilities/tests/test_scrubber.py
=
@@ -56,7 +56,7 @@ This is the first text/plain part
 A message part incompatible with plain text digests has been removed ...
 Name: not available
 Type: text/html
-Size: 34 bytes
+Size: 27 bytes
 Desc: not available
 -- next part --
 Plain text with \\u201cfancy quotes\\u201d from embedded message.
@@ -64,12 +64,12 @@ Plain text with \\u201cfancy quotes\\u201d from embedded 
message.
 A message part incompatible with plain text digests has been removed ...
 Name: not available
 Type: text/html
-Size: 64 bytes
+Size: 58 bytes
 Desc: not available
 -- next part --
 A message part incompatible with plain text digests has been removed ...
 Name: Image
 Type: image/jpeg
-Size: 144 bytes
+Size: 16 bytes
 Desc: A JPEG image
 """)



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/32c9dc70d0a6be08739619f5709140b0188494b8...9176bf6ee3fa8c707e8a60aeca495e799c07e216

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/32c9dc70d0a6be08739619f5709140b0188494b8...9176bf6ee3fa8c707e8a60aeca495e799c07e216
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Creates parent directory for digest.mmdf if not present

2020-12-02 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
040472d8 by nerrehmit at 2020-12-02T23:57:40+00:00
Creates parent directory for digest.mmdf if not present

Checks if the path for the digest.mmdf file exists and creates the parent 
directory if not.

- - - - -
32c9dc70 by Mark Sapiro at 2020-12-02T23:57:41+00:00
Merge branch 'fix/missing-directory-699' into 'master'

Creates parent directory for digest.mmdf if not present

Closes #699

See merge request mailman/mailman!735
- - - - -


3 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/handlers/tests/test_to_digest.py
- src/mailman/handlers/to_digest.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -23,6 +23,8 @@ Bugs
 * Implemented a ``scrubber`` for plain text digests.  (Closes #473)
 * The ``mailman gatenews`` command now adds ``original_size`` as a message
   attribute.  (Extends fix for #762)
+* Handle FileNotFoundError when creating digest.mmdf file without
+  parent directory present (Closes #699)
 
 New Features
 


=
src/mailman/handlers/tests/test_to_digest.py
=
@@ -51,3 +51,13 @@ Message-ID: 
 # Make sure the digest mbox is not empty.
 mailbox_path = os.path.join(self._mlist.data_path, 'digest.mmdf')
 self.assertGreater(os.path.getsize(mailbox_path), 0)
+
+def test_absent_parent_directory(self):
+# Remove parent directory to setup for testing
+os.rmdir(self._mlist.data_path)
+# Call process function
+self._msg.set_payload('test')
+self._msg['X-Test'] = 'dummy'
+self._handler.process(self._mlist, self._msg, {})
+# Assert digest.mmdf parent directory is present
+self.assertTrue(os.path.exists(self._mlist.data_path))


=
src/mailman/handlers/to_digest.py
=
@@ -43,6 +43,9 @@ class ToDigest:
 return
 # Open the mailbox that will be used to collect the current digest.
 mailbox_path = os.path.join(mlist.data_path, 'digest.mmdf')
+# Create parent directory of 'digest.mmdf' if not present
+if not os.path.exists(mlist.data_path):
+os.mkdir(mlist.data_path)
 # Lock the mailbox and append the message.
 with Mailbox(mailbox_path, create=True) as mbox:
 mbox.add(msg)



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/6dd196a4b8a3c353023f14e17377b1f9380b7439...32c9dc70d0a6be08739619f5709140b0188494b8

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/6dd196a4b8a3c353023f14e17377b1f9380b7439...32c9dc70d0a6be08739619f5709140b0188494b8
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Also add original_size as a message attribute in gatenews.

2020-11-27 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
df96c5f5 by Mark Sapiro at 2020-11-27T15:55:04-08:00
Also add original_size as a message attribute in gatenews.

- - - - -
e4e4ea0d by Mark Sapiro at 2020-11-28T01:04:02+00:00
Merge branch 'osize' into 'master'

Also add original_size as a message attribute in gatenews.

Closes #762

See merge request mailman/mailman!738
- - - - -


3 changed files:

- src/mailman/commands/cli_gatenews.py
- src/mailman/commands/tests/test_cli_gatenews.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/commands/cli_gatenews.py
=
@@ -105,9 +105,12 @@ def poll_newsgroup(mlist, conn, first, last, glock):
 msg['To'] = mlist.posting_address
 # Post the message to the list
 inq = config.switchboards['in']
+# original_size is both a message attribute and a key in
+# msgdata.
+msg.original_size = len(msg.as_bytes())
 inq.enqueue(msg,
 listid=mlist.list_id,
-original_size=len(msg.as_bytes()),
+original_size=msg.original_size,
 fromusenet=True)
 log.info('posted to list %s: %7d', listname, num)
 except nntplib.NNTPError as e:


=
src/mailman/commands/tests/test_cli_gatenews.py
=
@@ -241,10 +241,13 @@ class Test_gatenews(TestCase):
 self.assertEqual(lines[3], 'Bad message')
 self.assertTrue(lines[4].endswith('myl...@example.com watermark: 3'))
 
-def test_original_size_in_msgdata(self):
+def test_original_size_in_msgdata_and_message(self):
 with get_nntplib_nntp():
 self._command.invoke(gatenews)
 items = get_queue_messages('in', expected_count=1)
 msgdata = items[0].msgdata
+msg = items[0].msg
 self.assertTrue(msgdata.get('original_size', False))
 self.assertEqual(msgdata['original_size'], 184)
+self.assertTrue(hasattr(msg, 'original_size'))
+self.assertEqual(msg.original_size, 184)


=
src/mailman/docs/NEWS.rst
=
@@ -21,6 +21,8 @@ Bugs
 * Increased the size of the data column in the workflowstate table.
   (Closes #793)
 * Implemented a ``scrubber`` for plain text digests.  (Closes #473)
+* The ``mailman gatenews`` command now adds ``original_size`` as a message
+  attribute.  (Extends fix for #762)
 
 New Features
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/ab4390b357b7a0107aa1df0486e69627bc656f35...e4e4ea0d062b4def557a4f09967b8a6b4decb227

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/ab4390b357b7a0107aa1df0486e69627bc656f35...e4e4ea0d062b4def557a4f09967b8a6b4decb227
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 3 commits: expose list config send_goodbye_message through REST

2020-11-27 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
76bd8b6a by Pierre Gay at 2020-11-27T13:50:12+01:00
expose list config send_goodbye_message through REST

- - - - -
9b36ab61 by Pierre Gay at 2020-11-27T20:08:54+01:00
add NEWS.rst note

- - - - -
ab4390b3 by Mark Sapiro at 2020-11-28T00:52:00+00:00
Merge branch 'rest_listconfig_send_goodbye_message' into 
'master'

expose list config send_goodbye_message through REST

See merge request mailman/mailman!737
- - - - -


5 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/rest/docs/listconf.rst
- src/mailman/rest/listconf.py
- src/mailman/rest/tests/test_listconf.py
- src/mailman/rest/tests/test_lists.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -28,6 +28,11 @@ New Features
   mailman.cfg.  If this is set to ``yes``, posts with a digest like Subject:
   header or which quote the digest masthead will be held for moderation.
 
+REST
+
+* List configuration option ``send_goodbye_message`` is now exposed through
+  the REST API. (See !737)
+
 3.3.2
 =
 


=
src/mailman/rest/docs/listconf.rst
=
@@ -108,6 +108,7 @@ All readable attributes for a list are available on a 
sub-resource.
 request_address: ant-requ...@example.com
 require_explicit_destination: True
 respond_to_post_requests: True
+send_goodbye_message: True
 send_welcome_message: True
 subject_prefix: [Ant]
 subscription_policy: confirm
@@ -187,6 +188,7 @@ When using ``PUT``, all writable attributes must be 
included.
 ... reply_to_address='b...@example.com',
 ... require_explicit_destination=False,
 ... member_roster_visibility='members',
+... send_goodbye_message=False,
 ... send_welcome_message=False,
 ... subject_prefix='[ant]',
 ... subscription_policy='moderate',
@@ -287,6 +289,7 @@ These values are changed permanently.
 ...
 require_explicit_destination: False
 respond_to_post_requests: True
+send_goodbye_message: False
 send_welcome_message: False
 subject_prefix: [ant]
 subscription_policy: moderate


=
src/mailman/rest/listconf.py
=
@@ -233,6 +233,7 @@ ATTRIBUTES = dict(
 request_address=GetterSetter(None),
 require_explicit_destination=GetterSetter(as_boolean),
 respond_to_post_requests=GetterSetter(as_boolean),
+send_goodbye_message=GetterSetter(as_boolean),
 send_welcome_message=GetterSetter(as_boolean),
 subject_prefix=GetterSetter(str),
 subscription_policy=GetterSetter(enum_validator(SubscriptionPolicy)),


=
src/mailman/rest/tests/test_listconf.py
=
@@ -112,6 +112,7 @@ RESOURCE = dict(
 reply_to_address='b...@example.com',
 require_explicit_destination=True,
 member_roster_visibility='public',
+send_goodbye_message=False,
 send_welcome_message=False,
 subject_prefix='[ant]',
 subscription_policy='confirm_then_moderate',
@@ -518,6 +519,28 @@ class TestConfiguration(unittest.TestCase):
 'PATCH')
 self.assertEqual(self._mlist.info, '')
 
+def test_patch_send_welcome_message(self):
+with transaction():
+self._mlist.send_welcome_message = False
+resource, response = call_api(
+'http://localhost:9001/3.0/lists/ant.example.com/config'
+'/send_welcome_message',
+dict(send_welcome_message=True),
+'PATCH')
+self.assertEqual(response.status_code, 204)
+self.assertTrue(self._mlist.send_welcome_message)
+
+def test_patch_send_goodbye_message(self):
+with transaction():
+self._mlist.send_goodbye_message = False
+resource, response = call_api(
+'http://localhost:9001/3.0/lists/ant.example.com/config'
+'/send_goodbye_message',
+dict(send_goodbye_message=True),
+'PATCH')
+self.assertEqual(response.status_code, 204)
+self.assertTrue(self._mlist.send_goodbye_message)
+
 def test_delete_top_level_listconf(self):
 with self.assertRaises(HTTPError) as cm:
 call_api('http://localhost:9001/3.0/lists/ant.example.com/config',


=
src/mailman/rest/tests/test_lists.py
=
@@ -634,6 +634,7 @@ class TestListDigests(unittest.TestCase):
 def setUp(self):
 with transaction():
 self._mlist = create_list('a...@example.com')
+self._mlist.send_goodbye_message = False
 self._mlist.send_welcome_message = False
 anne = getUtility(IUserManager).create_address('a...@example.com')
 self._mlist.subscribe

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Increased the size of the data column in the workflowstate table.

2020-11-14 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
28b7b98b by Mark Sapiro at 2020-11-14T13:39:40-08:00
Increased the size of the data column in the workflowstate table.

- - - - -
551390c4 by Mark Sapiro at 2020-11-14T22:02:19+00:00
Merge branch 'workflow' into 'master'

Increased the size of the data column in the workflowstate table.

Closes #793

See merge request mailman/mailman!730
- - - - -


3 changed files:

- + 
src/mailman/database/alembic/versions/2b73fbcc97c9_increase_workflowstate_data_column_size.py
- src/mailman/docs/NEWS.rst
- src/mailman/model/workflow.py


Changes:

=
src/mailman/database/alembic/versions/2b73fbcc97c9_increase_workflowstate_data_column_size.py
=
@@ -0,0 +1,44 @@
+# Copyright (C) 2020 by the Free Software Foundation, Inc.
+#
+# This file is part of GNU Mailman.
+#
+# GNU Mailman is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# GNU Mailman.  If not, see .
+
+"""increase_workflowstate_data_column_size
+
+Revision ID: 2b73fbcc97c9
+Revises: 9735f5e5dbdb
+Create Date: 2020-11-14 12:25:50.833363
+
+"""
+
+from alembic import op
+from mailman.database.types import SAUnicode, SAUnicodeLarge
+
+
+# revision identifiers, used by Alembic.
+revision = '2b73fbcc97c9'
+down_revision = '9735f5e5dbdb'
+
+
+def upgrade():
+# Adding the invitation parameter can make the data value too long for
+# MySQL SaUnicode.
+with op.batch_alter_table('workflowstate') as batch_op:
+batch_op.alter_column('data', type_=SAUnicodeLarge)
+
+
+def downgrade():
+with op.batch_alter_table('workflowstate') as batch_op:
+batch_op.alter_column('data', type_=SAUnicode)


=
src/mailman/docs/NEWS.rst
=
@@ -16,6 +16,8 @@ Here is a history of user visible changes to Mailman.
 Bugs
 
 * Handle some UnicodeEncodeErrors in creating digests.  (Closes #560)
+* Increased the size of the data column in the workflowstate table.
+  (Closes #793)
 
 3.3.2
 =


=
src/mailman/model/workflow.py
=
@@ -19,7 +19,7 @@
 
 from mailman.database.model import Model
 from mailman.database.transaction import dbconnection
-from mailman.database.types import SAUnicode
+from mailman.database.types import SAUnicode, SAUnicodeLarge
 from mailman.interfaces.workflow import IWorkflowState, IWorkflowStateManager
 from public import public
 from sqlalchemy import Column
@@ -35,7 +35,7 @@ class WorkflowState(Model):
 
 token = Column(SAUnicode, primary_key=True)
 step = Column(SAUnicode)
-data = Column(SAUnicode)
+data = Column(SAUnicodeLarge)
 
 
 @public



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/9bc78976f5b4d1185cd667552133893f23dd36ce...551390c4eadb657e54b58c4e3d05b60dee2a3dbe

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/9bc78976f5b4d1185cd667552133893f23dd36ce...551390c4eadb657e54b58c4e3d05b60dee2a3dbe
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Handle/Avoid some UnicodeEncodeErrors when creating digests.

2020-11-14 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
f5b889b6 by Mark Sapiro at 2020-11-13T20:57:51-08:00
Handle/Avoid some UnicodeEncodeErrors when creating digests.

- - - - -
9bc78976 by Mark Sapiro at 2020-11-14T20:02:37+00:00
Merge branch 'digest' into 'master'

Handle/Avoid some UnicodeEncodeErrors when creating digests.

Closes #560

See merge request mailman/mailman!729
- - - - -


5 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/runners/digest.py
- + src/mailman/runners/tests/data/__init__.py
- + src/mailman/runners/tests/data/ascii_in_utf7.eml
- src/mailman/runners/tests/test_digest.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -8,6 +8,15 @@ Copyright (C) 1998-2018 by the Free Software Foundation, Inc.
 Here is a history of user visible changes to Mailman.
 
 
+3.3.3
+=
+
+(202x-xx-xx)
+
+Bugs
+
+* Handle some UnicodeEncodeErrors in creating digests.  (Closes #560)
+
 3.3.2
 =
 


=
src/mailman/runners/digest.py
=
@@ -252,7 +252,9 @@ class RFC1153Digester(Digester):
 # multipart message.  In that case, just stringify it.
 payload = msg.get_payload(decode=True)
 if not payload:
-payload = msg.as_string().split('\n\n', 1)[1]
+# Get the message as bytes to avoid UnicodeEncodeError from
+# as_string() when charset is incorrectly declared.
+payload = msg.as_bytes().split(b'\n\n', 1)[1]
 if isinstance(payload, bytes):
 try:
 # Do the decoding inside the try/except so that if the charset
@@ -286,13 +288,14 @@ class RFC1153Digester(Digester):
 print(sign_off, file=self._text)
 print('*' * len(sign_off), file=self._text)
 # If the digest message can't be encoded by the list character set,
-# fall back to utf-8.
+# fall back to utf-8 with error replacement.
 text = self._text.getvalue()
 try:
 self._message.set_payload(text.encode(self._charset),
   charset=self._charset)
 except UnicodeError:
-self._message.set_payload(text.encode('utf-8'), charset='utf-8')
+self._message.set_payload(text.encode('utf-8', errors='replace'),
+  charset='utf-8')
 return self._message
 
 


=
src/mailman/runners/tests/data/__init__.py
=


=
src/mailman/runners/tests/data/ascii_in_utf7.eml
=
@@ -0,0 +1,34 @@
+From: u...@example.com
+To: l...@example.com
+Content-Type: text/plain; charset="UTF-7"
+Mime-Version: 1.0
+Content-Transfer-Encoding: 7bit
+
+-BEGIN PGP SIGNED MESSAGE-
+Hash: SHA512
+
+On Fri, 2019-03-01 at 08:02 -0800, Mark S wrote:
++AD4 On 3/1/19 5:00 AM, Jim X via Mailman-cabal wrote:
++AD4 +AD4 Can i haz wiki write permissions?
++AD4 
++AD4 Yes, and now you do.
+
+Thank you,
+
+- -Jim X.
+-BEGIN PGP SIGNATURE-
+
+iQIzBAEBCgAdFiEECPbAhaBWEfiXj/kxdRlcPb+1fkUFAlx5WHkACgkQdRlcPb+1
+fkWe/w/+PEhOx7gyMjHdGT8hr3dZ2Hcr1PQPnM3h1BK5jE2NbWH4OaUotaes7Lo5
+Wjph4Z8UbJJcaFawqdIJgRbt+kK1HVPWysj69F16XfnZ0ANqE6LzSEzax7eNQJoD
+e2LSvs1YtKKRTDtXyjGgr4F2PjK6tEeuIhs7c1b1Nwp27HMFICh2KWAHEoRAuynI
+s98N3lh5llXg+enbj1RqLFkUGZYv+WZ3x/1oD3OwHLt17BGvNBSHhxKayaUq9mwu
+p6y/CI+Gyx8TAD6MiOplSBIq07zTMv5MhJBlqIZLkb5QGP6ClTNLytANh+aVYLqs
+qi4glr6FlcULDe2/GFv1yr4VphNEj7mxvUNBN+oO4ReQA/4asmG7l+aPDv8cpyWA
+yn//Urhh6GXP7zohvkGVzlMmccgJP7gQTgzpCdA3dNEYyQlDcSvjmehjWyUdGLWV
+X70y8PK1jbHyvkH0u9PpdTiG5JhoWFSpcoI0NdGnzL7prXxOl4fflSinxD0Nf7UD
+Y8CViLpmmqxiwFiDYYGXEzkMyCK7F6kZPgL7PVGUrJOvSXVoIBHvVL7J09s6MnvA
+3qZd/LrgaDjjJVwZrdKvwSxPyat4/Jb/pOETfJJyGANFLdLLfbLZfvcI0JPNWluX
+8tViRnap7tR+NpVn/56SoN/6jVUM8Uxtrrtju80oMvwbTYh2Icc=
+=ZGd6
+-END PGP SIGNATURE-


=
src/mailman/runners/tests/test_digest.py
=
@@ -21,8 +21,10 @@ import os
 import re
 import unittest
 
+from email import message_from_binary_file, message_from_bytes
 from email.iterators import _structure as structure
 from email.mime.text import MIMEText
+from importlib_resources import open_binary
 from io import StringIO
 from mailman.app.lifecycle import create_list
 from mailman.config import config
@@ -101,6 +103,52 @@ class TestDigest(unittest.TestCase):
 self.assertEqual(len(self._shuntq.files), 0, error_log.read())
 self._check_virgin_queue()
 
+def test_utf7_message_with_inline_ascii_sig(self):
+# The test message is bigger than 1K.  Set the threshold bigger to
+# avoid double processing in make_digest_messages.
+self._mlist.digest_size_threshold = 5
+# Subscribe some users receiving digests.
+anne = subscribe(self._mlist, 'Anne')
+

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Fixed a couple of typos.

2020-10-24 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
02a6cbb5 by Mark Sapiro at 2020-10-24T11:33:44-07:00
Fixed a couple of typos.

- - - - -
c39ee57e by Mark Sapiro at 2020-10-24T18:58:16+00:00
Merge branch 'typo' into 'master'

Fixed a couple of typos.

See merge request mailman/mailman!726
- - - - -


1 changed file:

- src/mailman/commands/docs/digests.rst


Changes:

=
src/mailman/commands/docs/digests.rst
=
@@ -2,9 +2,9 @@
 Sending Digests
 ===
 
-Whwn a list's ``digests_enabled`` setting is ``True``, Mailman accumulates
+When a list's ``digests_enabled`` setting is ``True``, Mailman accumulates
 list posts in a mailbox for eventual sending to digest members.  When the size
-of this maolbox reaches the list's ``digest_size_threshold``, a digest is sent
+of this mailbox reaches the list's ``digest_size_threshold``, a digest is sent
 to the digest members and the mailbox is cleared.
 
 A list may also have its ``digest_send_periodic`` setting ``True`` in which



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/612e309fee22b70a4295ac5ece042d50b94495b4...c39ee57ed449a1525be4dd5dade668e1075eda7c

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/612e309fee22b70a4295ac5ece042d50b94495b4...c39ee57ed449a1525be4dd5dade668e1075eda7c
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 3 commits: Clarify the posting instruction in the list welcome message.

2020-10-15 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
4ecf6a14 by Mark Sapiro at 2020-10-15T09:36:09-07:00
Clarify the posting instruction in the list welcome message.

- - - - -
0bca998f by Mark Sapiro at 2020-10-15T10:29:28-07:00
Updated test for prior commit.

- - - - -
437cb49f by Mark Sapiro at 2020-10-15T14:02:36-07:00
Merge branch 'template' into 'master'

Clarify the posting instruction in the list welcome message.

See merge request mailman/mailman!723

- - - - -


2 changed files:

- src/mailman/rest/docs/templates.rst
- src/mailman/templates/en/list:user:notice:welcome.txt


Changes:

=
src/mailman/rest/docs/templates.rst
=
@@ -45,7 +45,7 @@ subscribed to the mailing list, she sees this plain welcome 
message.
 
 Welcome to the "Ant" mailing list!
 
-To post to this list, send your email to:
+To post to this list, send your message to:
 
   a...@example.com
 


=
src/mailman/templates/en/list:user:notice:welcome.txt
=
@@ -1,6 +1,6 @@
 Welcome to the "$display_name" mailing list!
 
-To post to this list, send your email to:
+To post to this list, send your message to:
 
   $listname
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/98cf97b1777aa0ddc0a455e1df6e6c57691f8427...437cb49ffc29ef8960ef26d18bd883ed5aa61ded

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/98cf97b1777aa0ddc0a455e1df6e6c57691f8427...437cb49ffc29ef8960ef26d18bd883ed5aa61ded
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Fix a typo and add clarification.

2020-10-02 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
df4c8402 by Mark Sapiro at 2020-10-02T19:34:54-07:00
Fix a typo and add clarification.

- - - - -
c3b807ee by Mark Sapiro at 2020-10-03T02:58:39+00:00
Merge branch 'doc' into 'master'

Fix a typo and add clarification.

See merge request mailman/mailman!711
- - - - -


1 changed file:

- src/mailman/handlers/docs/filtering.rst


Changes:

=
src/mailman/handlers/docs/filtering.rst
=
@@ -512,7 +512,8 @@ Passing and filtering extensions
 ``pass_extensions`` and ``filter_extensions`` work in exactly the same way.
 These filters are applied following ``filter_types`` and ``pass_types`` and
 filter based on the filename extension of any part that has an associated
-file name.  Here's a symple example.
+filename with extension.  Parts that don't have an associated filename with
+an extension are not affected.  Here's a simple example.
 ::
 
 >>> mlist.filter_types = []



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/c33b02b3bd88355ac8b6e38069897fe6d273f0dd...c3b807ee751d303b4f2552752e7c5ad4056d203b

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/c33b02b3bd88355ac8b6e38069897fe6d273f0dd...c3b807ee751d303b4f2552752e7c5ad4056d203b
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Refactor importer to not add/delete non-regexps to *_these_nonmembers.

2020-09-26 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
86141989 by Mark Sapiro at 2020-09-26T23:05:14-07:00
Refactor importer to not add/delete non-regexps to *_these_nonmembers.

- - - - -
ce3ed415 by Mark Sapiro at 2020-09-27T06:42:22+00:00
Merge branch 'import' into 'master'

Refactor importer to not add/delete non-regexps to *_these_nonmembers.

Closes #773

See merge request mailman/mailman!709
- - - - -


2 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/utilities/importer.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -58,6 +58,9 @@ Command line
 * Added a ``charset`` option to the ``import21`` subcommand.  (Closes #769)
 * The ``import21`` subcommand will now truncate long SAUnicode values if the
   database is MySQL.  (Closes #772)
+* The ``import21`` subcommand no longer adds the entire legacy
+  ``*_these_nonmembers`` list and then removes the non-regexps.  It now just
+  adds the regexps.  (Closes #773)
 
 REST
 


=
src/mailman/utilities/importer.py
=
@@ -265,9 +265,13 @@ DATETIME_COLUMNS = [
 ]
 
 EXCLUDES = set((
+'accept_these_nonmembers',
 'delivery_status',
 'digest_members',
+'discard_these_nonmembers',
+'hold_these_nonmembers',
 'members',
+'reject_these_nonmembers',
 'user_options',
 ))
 
@@ -566,10 +570,11 @@ def import_config_pck(mlist, config_dict):
 action_name = 'defer'
 import_roster(mlist, config_dict, emails, MemberRole.nonmember,
   Action[action_name])
-# Only keep the regexes in the legacy list property.
+# Now add the regexes in the legacy list property.
 list_prop = getattr(mlist, prop_name)
-for email in emails:
-list_prop.remove(email)
+for addr in config_dict.get(prop_name, []):
+if addr.startswith('^'):
+list_prop.append(addr)
 finally:
 mlist.send_welcome_message = send_welcome_message
 mlist.admin_notify_mchanges = admin_notify_mchanges



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/34104ae0960d0234d438cc64e3c150202c25e090...ce3ed415ccd5bd0a11ae4d84e1c109b9985988b2

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/34104ae0960d0234d438cc64e3c150202c25e090...ce3ed415ccd5bd0a11ae4d84e1c109b9985988b2
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Truncate long SAUnicode values to 255 chars for MySQL.

2020-09-26 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
3885139c by Mark Sapiro at 2020-09-26T21:43:04-07:00
Truncate long SAUnicode values to 255 chars for MySQL.

- - - - -
34104ae0 by Mark Sapiro at 2020-09-27T05:25:27+00:00
Merge branch 'import' into 'master'

Truncate long SAUnicode values to 255 chars for MySQL.

Closes #772

See merge request mailman/mailman!708
- - - - -


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
=
@@ -56,6 +56,8 @@ Command line
   show sections defined only in mailman.cfg in addition to those from
   schema.cfg.  (Closes #736)
 * Added a ``charset`` option to the ``import21`` subcommand.  (Closes #769)
+* The ``import21`` subcommand will now truncate long SAUnicode values if the
+  database is MySQL.  (Closes #772)
 
 REST
 


=
src/mailman/utilities/importer.py
=
@@ -25,6 +25,9 @@ import logging
 import datetime
 
 from contextlib import ExitStack
+from mailman.config import config
+from mailman.database.helpers import is_mysql
+from mailman.database.types import SAUnicode
 from mailman.handlers.decorate import decorate_template
 from mailman.interfaces.action import Action, FilterAction
 from mailman.interfaces.address import IEmailValidator
@@ -192,6 +195,19 @@ enabled: yes
 return code
 
 
+def maybe_truncate_mysql(value):
+# For MySQL, column type SAUnicode is VARCHAR(255).  In many MySQL
+# configurations, attempts to store longer values are fatal.
+if is_mysql(config.db.engine) and len(value) > 255:
+# This actually is covered but only if db is MySQL.
+print(# pragma: nocover
+  """Length of value for {} is {} which is too long for MySQL.
+Truncated from {}
+to {}""".format(key, len(value), value, value[:255]), file=sys.stderr)
+return value[:255]# pragma: nocover
+return value
+
+
 # Attributes in Mailman 2 which have a different type in Mailman 3.  Some
 # types (e.g. bools) are autodetected from their SA column types.
 TYPES = dict(
@@ -265,6 +281,7 @@ def import_config_pck(mlist, config_dict):
 :param config_dict: The Mailman 2.1 configuration dictionary.
 :type config_dict: dict
 """
+global key
 for key, value in config_dict.items():
 # Some attributes must not be directly imported.
 if key in EXCLUDES:
@@ -290,6 +307,8 @@ def import_config_pck(mlist, config_dict):
 column = getattr(mlist.__class__, key, None)
 if column is not None and isinstance(column.type, Boolean):
 converter = bool
+if column is not None and isinstance(column.type, SAUnicode):
+converter = maybe_truncate_mysql
 try:
 if converter is not None:
 value = converter(value)


=
src/mailman/utilities/tests/test_import.py
=
@@ -26,6 +26,7 @@ from enum import Enum
 from importlib_resources import open_binary
 from mailman.app.lifecycle import create_list
 from mailman.config import config
+from mailman.database.helpers import is_mysql
 from mailman.handlers.decorate import decorate
 from mailman.interfaces.action import Action, FilterAction
 from mailman.interfaces.address import InvalidEmailAddressError
@@ -606,6 +607,22 @@ class TestBasicImport(unittest.TestCase):
 self.assertIn('Skipping duplicate header_filter rule',
   error_log.readline())
 
+def test_long_saunicode(self):
+# Long SAUnicode fields should truncate for MySql with warning only.
+long_desc = (
+'A very long description exceeding 255 ckaracters to test '
+'truncation of SAUnicode field data for MySQL. just add some '
+'dots ...'
+''
+'... and a bit more Thats 255 ending at more')
+self._pckdict['description'] = long_desc
+self._import()
+if is_mysql(config.db.engine):
+self.assertEqual(long_desc[:255], self._mlist.description)
+self.assertTrue(self._mlist.description.endswith('a bit more'))
+else:
+self.assertEqual(long_desc, self._mlist.description)
+
 
 class TestArchiveImport(unittest.TestCase):
 """Test conversion of the archive policies.



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/29fd56936d4deb484c9e926a9b32ebc5d18c79f8...34104ae0960d0234d438cc64e3c150202c25e090

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/29fd56936d4deb484c9e926a9b32ebc5d18c79f8...34104ae0960

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Remove extraneous apostrophe from help text.

2020-09-24 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
8e46c5c5 by Mark Sapiro at 2020-09-24T07:15:55-07:00
Remove extraneous apostrophe from help text.

- - - - -
29fd5693 by Mark Sapiro at 2020-09-24T14:55:26+00:00
Merge branch 'xxx' into 'master'

Remove extraneous apostrophe from help text.

See merge request mailman/mailman!706
- - - - -


1 changed file:

- src/mailman/commands/cli_import.py


Changes:

=
src/mailman/commands/cli_import.py
=
@@ -49,7 +49,7 @@ class _Bouncer:
 @click.command(
 cls=I18nCommand,
 help=_("""\
-Import Mailman 2.1 list data'.  Requires the fully-qualified name of the
+Import Mailman 2.1 list data.  Requires the fully-qualified name of the
 list to import and the path to the Mailman 2.1 pickle file."""))
 @click.option(
 '--charset', '-c', default='utf-8',



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/86bd4319b4beb7eb327a53e14ce72439fd2a6f70...29fd56936d4deb484c9e926a9b32ebc5d18c79f8

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/86bd4319b4beb7eb327a53e14ce72439fd2a6f70...29fd56936d4deb484c9e926a9b32ebc5d18c79f8
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Move the Message: n header to the top in the plain digest.

2020-09-17 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
4db9859b by Mark Sapiro at 2020-09-17T20:08:58-07:00
Move the Message: n header to the top in the plain digest.

- - - - -
3338ba65 by Mark Sapiro at 2020-09-18T03:48:46+00:00
Merge branch 'digest' into 'master'

Move the Message: n header to the top in the plain digest.

See merge request mailman/mailman!704
- - - - -


2 changed files:

- src/mailman/runners/digest.py
- src/mailman/runners/docs/digester.rst


Changes:

=
src/mailman/runners/digest.py
=
@@ -177,6 +177,9 @@ class MIMEDigester(Digester):
 # scrubs out attachments.
 digest_msg = MIMEMessage(deepcopy(msg))
 digest_msg_content = digest_msg.get_payload(0)
+# It would be nice to add Message: n near the beginning, but there's no
+# method for that.  MUAs mostly don't display it anyway, so it doesn't
+# really matter.
 digest_msg_content['Message'] = str(count)
 self._digest_part.attach(digest_msg)
 
@@ -235,14 +238,15 @@ class RFC1153Digester(Digester):
 print(self._separator30, file=self._text)
 print(file=self._text)
 # Each message section contains a few headers.
+# add the Message: n header first.
+print('Message: {}'.format(count), file=self._text)
+# Then the others.
 for header in config.digests.plain_digest_keep_headers.split():
 if header in msg:
 value = oneline(msg[header], in_unicode=True)
 value = wrap('{}: {}'.format(header, value))
 value = '\n\t'.join(value.split('\n'))
 print(value, file=self._text)
-# add the Message: header.
-print('Message: {}'.format(count), file=self._text)
 print(file=self._text)
 # Add the payload.  If the decoded payload is empty, this may be a
 # multipart message.  In that case, just stringify it.


=
src/mailman/runners/docs/digester.rst
=
@@ -269,37 +269,37 @@ The RFC 1153 contains the digest in a single plain text 
message.
 
 --
 
+Message: 1
 From: aper...@example.com
 Subject: Test message 1
 To: xt...@example.com
-Message: 1
 
 Here is message 1
 
 --
 
+Message: 2
 From: aper...@example.com
 Subject: Test message 2
 To: xt...@example.com
-Message: 2
 
 Here is message 2
 
 --
 
+Message: 3
 From: aper...@example.com
 Subject: Test message 3
 To: xt...@example.com
-Message: 3
 
 Here is message 3
 
 --
 
+Message: 4
 From: aper...@example.com
 Subject: Test message 4
 To: xt...@example.com
-Message: 4
 
 Here is message 4
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/f667f608d0dcee5374a7ae7ee1b57ed5f5a4be33...3338ba6598e218c9894dd4eae8b27388ba38c9b4

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/f667f608d0dcee5374a7ae7ee1b57ed5f5a4be33...3338ba6598e218c9894dd4eae8b27388ba38c9b4
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Fix minor indentation issue in mailman/rest/docs/sub-moderation.rst.

2020-09-16 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
b9e4b481 by Mark Sapiro at 2020-09-16T09:41:01-07:00
Fix minor indentation issue in mailman/rest/docs/sub-moderation.rst.

- - - - -
f667f608 by Mark Sapiro at 2020-09-16T17:07:37+00:00
Merge branch 'docs' into 'master'

Fix minor indentation issue in mailman/rest/docs/sub-moderation.rst.

See merge request mailman/mailman!703
- - - - -


1 changed file:

- src/mailman/rest/docs/sub-moderation.rst


Changes:

=
src/mailman/rest/docs/sub-moderation.rst
=
@@ -85,7 +85,7 @@ request's resource.  The POST data requires an action of one 
of the following:
 
  * discard - throw the request away.
  * reject - the request is denied and a notification is sent to the email
-address requesting the membership change.
+   address requesting the membership change.
  * defer - defer any action on this membership change (continue to hold it).
  * accept - accept the membership change.
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/71fac20aa6df548ebbbe71693dce328ac5ed692a...f667f608d0dcee5374a7ae7ee1b57ed5f5a4be33

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/71fac20aa6df548ebbbe71693dce328ac5ed692a...f667f608d0dcee5374a7ae7ee1b57ed5f5a4be33
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Fix gatenews to add original_size to msgdata.

2020-09-12 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
469b0056 by Mark Sapiro at 2020-09-12T20:17:35-07:00
Fix gatenews to add original_size to msgdata.

- - - - -
71fac20a by Mark Sapiro at 2020-09-13T03:43:13+00:00
Merge branch 'nntp' into 'master'

Fix gatenews to add original_size to msgdata.

See merge request mailman/mailman!702
- - - - -


3 changed files:

- src/mailman/commands/cli_gatenews.py
- src/mailman/commands/tests/test_cli_gatenews.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/commands/cli_gatenews.py
=
@@ -107,6 +107,7 @@ def poll_newsgroup(mlist, conn, first, last, glock):
 inq = config.switchboards['in']
 inq.enqueue(msg,
 listid=mlist.list_id,
+original_size=len(msg.as_bytes()),
 fromusenet=True)
 log.info('posted to list %s: %7d', listname, num)
 except nntplib.NNTPError as e:


=
src/mailman/commands/tests/test_cli_gatenews.py
=
@@ -240,3 +240,11 @@ class Test_gatenews(TestCase):
   'my.group:2'))
 self.assertEqual(lines[3], 'Bad message')
 self.assertTrue(lines[4].endswith('myl...@example.com watermark: 3'))
+
+def test_original_size_in_msgdata(self):
+with get_nntplib_nntp():
+self._command.invoke(gatenews)
+items = get_queue_messages('in', expected_count=1)
+msgdata = items[0].msgdata
+self.assertTrue(msgdata.get('original_size', False))
+self.assertEqual(msgdata['original_size'], 184)


=
src/mailman/docs/NEWS.rst
=
@@ -43,6 +43,8 @@ Bugs
 * Messages in digests now contain a ``Message: N`` header.  (Closes #764)
 * The LMTP runner will now add a ``Message-ID:`` header if missing.
   (Closes #448 and #490)
+* The ``mailman gatenews`` command now adds ``original_size`` to the msgdata.
+  (Closes #762)
 
 Command line
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/2a3a6ac912f2844194d95f4627b5b09eff9d24f0...71fac20aa6df548ebbbe71693dce328ac5ed692a

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/2a3a6ac912f2844194d95f4627b5b09eff9d24f0...71fac20aa6df548ebbbe71693dce328ac5ed692a
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Generate a missing Message-ID: in LMTP runner.

2020-09-12 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
4207d38d by Mark Sapiro at 2020-09-12T17:21:05-07:00
Generate a missing Message-ID: in LMTP runner.

- - - - -
2a3a6ac9 by Mark Sapiro at 2020-09-13T00:44:17+00:00
Merge branch 'msgid' into 'master'

Generate a missing Message-ID: in LMTP runner.

Closes #490 and #448

See merge request mailman/mailman!701
- - - - -


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
=
@@ -41,6 +41,8 @@ Bugs
 * VERPed list welcome messages now have a correct envelope sender.
   (Closes #757)
 * Messages in digests now contain a ``Message: N`` header.  (Closes #764)
+* The LMTP runner will now add a ``Message-ID:`` header if missing.
+  (Closes #448 and #490)
 
 Command line
 


=
src/mailman/runners/lmtp.py
=
@@ -91,7 +91,6 @@ ERR_451 = '451 Requested action aborted: error in processing'
 ERR_501 = '501 Message has defects'
 ERR_502 = '502 Error: command HELO not implemented'
 ERR_550 = '550 Requested action not taken: mailbox unavailable'
-ERR_550_MID = '550 No Message-ID header provided'
 
 
 def split_recipient(address):
@@ -145,7 +144,13 @@ class LMTPHandler:
 # other missing information.
 message_id = msg.get('message-id')
 if message_id is None:
-return ERR_550_MID
+# We have observed cases in the wild where bounce DSNs have no
+# Message-ID; header.  Also, there are brain dead phone clients
+# that don't include a Message-ID: header.  Thus, we cave and
+# generate one. See https://gitlab.com/mailman/mailman/-/issues/448
+# and https://gitlab.com/mailman/mailman/-/issues/490.
+message_id = email.utils.make_msgid()
+msg['Message-ID'] = message_id
 if msg.defects:
 return ERR_501
 msg.original_size = len(envelope.content)


=
src/mailman/runners/tests/test_lmtp.py
=
@@ -43,21 +43,16 @@ class TestLMTP(unittest.TestCase):
 self._lmtp.lhlo('remote.example.org')
 self.addCleanup(self._lmtp.close)
 
-def test_message_id_required(self):
-# The message is rejected if it does not have a Message-ID header.
-with self.assertRaises(smtplib.SMTPDataError) as cm:
-self._lmtp.sendmail('a...@example.com', ['t...@example.com'], """\
+def test_message_id_supplied_if_missing(self):
+# A Message-ID header is generated if the message doesn't have one.
+self._lmtp.sendmail('a...@example.com', ['t...@example.com'], """\
 From: a...@example.com
 To: t...@example.com
 Subject: This has no Message-ID header
 
 """)
-# LMTP returns a 550: Requested action not taken: mailbox unavailable
-# (e.g., mailmailman.runners.tests.test_lmtp.TestLMTPbox not found, no
-# access, or command rejected for policy reasons)
-self.assertEqual(cm.exception.smtp_code, 550)
-self.assertEqual(cm.exception.smtp_error,
- b'No Message-ID header provided')
+items = get_queue_messages('in', expected_count=1)
+self.assertIsNotNone(items[0].msg.get('message-id'))
 
 def test_message_id_hash_is_added(self):
 self._lmtp.sendmail('a...@example.com', ['t...@example.com'], """\



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/fb6c2b44de7cd73bdb31f170e85e1d07710a686b...2a3a6ac912f2844194d95f4627b5b09eff9d24f0

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/fb6c2b44de7cd73bdb31f170e85e1d07710a686b...2a3a6ac912f2844194d95f4627b5b09eff9d24f0
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Fixed message.UserNotification() to work with recipients including

2020-08-28 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
9b8af392 by Mark Sapiro at 2020-08-29T02:57:04+00:00
Fixed message.UserNotification() to work with recipients including
display names.

- - - - -
b215a851 by Mark Sapiro at 2020-08-29T02:57:04+00:00
Merge branch 'env' into 'master'

Fixed message.UserNotification() to work with recipients including

Closes #757

See merge request mailman/mailman!696
- - - - -


4 changed files:

- src/mailman/app/tests/test_moderation.py
- src/mailman/app/tests/test_notifications.py
- src/mailman/docs/NEWS.rst
- src/mailman/email/message.py


Changes:

=
src/mailman/app/tests/test_moderation.py
=
@@ -125,7 +125,7 @@ Message-ID: 
 items = get_queue_messages('virgin', expected_count=1)
 self.assertEqual(str(items[0].msg['subject']),
  'Forward of moderated message')
-self.assertEqual(items[0].msgdata['recipients'],
+self.assertEqual(list(items[0].msgdata['recipients']),
  ['z...@example.com'])
 
 def test_survive_a_deleted_message(self):


=
src/mailman/app/tests/test_notifications.py
=
@@ -264,6 +264,17 @@ have any other questions, you may contact
 message = items[0].msg
 self.assertEqual(message['to'], 'Anne Person ')
 
+def test_member_susbcribed_address_has_display_name_not_msgdata(self):
+address = getUtility(IUserManager).create_address(
+'a...@example.com', 'Anne Person')
+address.verified_on = now()
+self._mlist.subscribe(address)
+items = get_queue_messages('virgin', expected_count=1)
+message = items[0].msg
+msgdata = items[0].msgdata
+self.assertEqual(message['to'], 'Anne Person ')
+self.assertEqual(list(msgdata['recipients']), ['a...@example.com'])
+
 def test_member_subscribed_address_has_no_display_name(self):
 address = getUtility(IUserManager).create_address('a...@example.com')
 address.verified_on = now()


=
src/mailman/docs/NEWS.rst
=
@@ -38,6 +38,8 @@ Bugs
 * Removed unnecessary call to ``Lock().disown()`` from ``bin/master.py``.
   (Closes #754)
 * Fixed an invalid logging call in bin/master.py.  (Closes #756)
+* VERPed list welcome messages now have a correct envelope sender.
+  (Closes #757)
 
 Command line
 


=
src/mailman/email/message.py
=
@@ -144,10 +144,11 @@ class UserNotification(Message):
 self['From'] = sender
 if isinstance(recipients, (list, set, tuple)):
 self['To'] = COMMASPACE.join(recipients)
-self.recipients = recipients
+self.recipients = {email.utils.parseaddr(recipient)[1] for
+   recipient in recipients}
 else:
 self['To'] = recipients
-self.recipients = set([recipients])
+self.recipients = set([email.utils.parseaddr(recipients)[1]])
 
 def send(self, mlist, *, add_precedence=True, **_kws):
 """Sends the message by enqueuing it to the 'virgin' queue.



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/dbdb4d61edc50ecd0074bbc08d1d02af4210...b215a85185ba54a01b77757c868ca8c855273274

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/dbdb4d61edc50ecd0074bbc08d1d02af4210...b215a85185ba54a01b77757c868ca8c855273274
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Added .format to log message string.

2020-08-27 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
e452d285 by Mark Sapiro at 2020-08-27T23:56:21+00:00
Added .format to log message string.

- - - - -
dbdb4d61 by Mark Sapiro at 2020-08-27T23:56:21+00:00
Merge branch 'log' into 'master'

Added .format to log message string.

Closes #756

See merge request mailman/mailman!695
- - - - -


2 changed files:

- src/mailman/bin/master.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/bin/master.py
=
@@ -448,8 +448,8 @@ Master detected subprocess exit
 # See if we've reached the maximum number of allowable restarts.
 if restarts > max_restarts:
 log.info("""\
-Runner {0} reached maximum restart limit of {1:d}, not restarting.""",
- rname, max_restarts)
+Runner {0} reached maximum restart limit of {1:d}, not restarting.""".format(
+ rname, max_restarts))
 # Now perhaps restart the process unless it exited with a
 # SIGTERM or we aren't restarting.
 if restart:


=
src/mailman/docs/NEWS.rst
=
@@ -37,6 +37,7 @@ Bugs
   requests for the same email address. (Closes #748)
 * Removed unnecessary call to ``Lock().disown()`` from ``bin/master.py``.
   (Closes #754)
+* Fixed an invalid logging call in bin/master.py.  (Closes #756)
 
 Command line
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/2972c16b7f1c64256053d78dd39d510d6a01e606...dbdb4d61edc50ecd0074bbc08d1d02af4210

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/2972c16b7f1c64256053d78dd39d510d6a01e606...dbdb4d61edc50ecd0074bbc08d1d02af4210
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Removed unnecessary call to Lock().disown() from bin/master.py.

2020-08-24 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
a819f1e3 by Mark Sapiro at 2020-08-24T15:56:46+00:00
Removed unnecessary call to Lock().disown() from bin/master.py.

- - - - -
2972c16b by Mark Sapiro at 2020-08-24T15:56:46+00:00
Merge branch 'lock' into 'master'

Removed unnecessary call to Lock().disown() from bin/master.py.

Closes #754

See merge request mailman/mailman!693
- - - - -


3 changed files:

- src/mailman/bin/master.py
- src/mailman/bin/tests/test_master.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/bin/master.py
=
@@ -128,9 +128,14 @@ def acquire_lock_1(force, lock_file=None):
 if not force:
 raise
 # Force removal of lock first.
-lock.disown()
 hostname, pid, tempfile = lock.details
 os.unlink(lock_file)
+# Also remove any stale claim files.
+dname = os.path.dirname(lock_file)
+for fname in os.listdir(dname):
+fpath = os.path.join(dname, fname)
+if fpath.startswith(lock_file):
+os.unlink(fpath)
 return acquire_lock_1(force=False)
 
 


=
src/mailman/bin/tests/test_master.py
=
@@ -61,6 +61,15 @@ class TestMaster(unittest.TestCase):
 lock.unlock()
 self.assertTrue(is_locked)
 
+def test_acquire_lock_1_force(self):
+# Create the lock and lock it.
+my_lock = Lock(self.lock_file)
+my_lock.lock(timedelta(seconds=60))
+# Try to aquire it again with force.
+lock = master.acquire_lock_1(True, self.lock_file)
+self.assertTrue(lock.is_locked)
+lock.unlock()
+
 def test_master_state(self):
 my_lock = Lock(self.lock_file)
 # Mailman is not running.


=
src/mailman/docs/NEWS.rst
=
@@ -35,6 +35,8 @@ Bugs
   (Closes #753)
 * Handle TOCTOU conditions when there are two simultaneous subscription
   requests for the same email address. (Closes #748)
+* Removed unnecessary call to ``Lock().disown()`` from ``bin/master.py``.
+  (Closes #754)
 
 Command line
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/8f14c86c69829f0cd55bb6722991c5c8f170a0e0...2972c16b7f1c64256053d78dd39d510d6a01e606

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/8f14c86c69829f0cd55bb6722991c5c8f170a0e0...2972c16b7f1c64256053d78dd39d510d6a01e606
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Pretty up the Message Filtering flow chart with HTML labels.

2020-08-22 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
90624a7b by Mark Sapiro at 2020-08-22T12:35:10-07:00
Pretty up the Message Filtering flow chart with HTML labels.

- - - - -
60481a3e by Mark Sapiro at 2020-08-22T19:59:56+00:00
Merge branch 'graph' into 'master'

Pretty up the Message Filtering flow chart with HTML labels.

See merge request mailman/mailman!692
- - - - -


1 changed file:

- src/mailman/docs/8-miles-high.rst


Changes:

=
src/mailman/docs/8-miles-high.rst
=
@@ -101,16 +101,70 @@ The default set of rules looks something like this:
 subgraph in { IN [shape=box, color=lightblue, style=filled]; }
 subgraph rules {
   rankdir=TB;
-  node [shape=box, style=rounded];
-  approved [label=" approved | {  no |  }"];
-  emergency [label=" emergency | {  no |  }"];
-  loop [label=" loop | {  no |  }"];
-  modmember [label=" member\nmoderated | {  no |  }"];
+  node [shape=none];
+  approved [label=<
+
+  
+approved
+  
+no
+  
+>];
+  emergency [label=<
+
+  
+emergency
+  
+no
+  
+>];
+  loop [label=<
+
+  
+loop
+  
+no
+  
+>];
+  modmember [label=<
+
+  
+member moderated
+  
+no
+  
+>];
   administrivia [group="0",
-label=" administrivia | {  no |  }"];
-  maxsize [label=" max\ size | { no | }"];
-  any [label=" any | { | }"];
-  truth [label=" truth | "];
+label=<
+
+  
+administrivia
+  
+no
+  
+>];
+  maxsize [label=<
+
+  
+max size
+  
+no
+  
+>];
+  any [label=<
+
+  
+any
+  
+no
+  
+>];
+  truth [label=<
+
+  
+truth
+  
+>];
 
 }
 
@@ -126,25 +180,25 @@ The default set of rules looks something like this:
 
 IN -> approved:in;
 approved:no -> emergency:in [weight="100"];
-approved:yes -> PIPELINE [minlen=2];
+approved:in -> PIPELINE [minlen=2];
 
 emergency:no -> loop:in;
-emergency:yes -> HOLD;
+emergency:in -> HOLD;
 
 loop:no -> modmember:in;
-loop:yes -> DISCARD;
+loop:in -> DISCARD;
 
 modmember:no -> administrivia:in;
-modmember:yes -> MODERATION;
+modmember:in -> MODERATION;
 
 administrivia:no -> maxsize:in;
-administrivia:yes -> action;
+administrivia:in -> action;
 
 maxsize:no -> any:in;
-maxsize:yes -> MODERATION;
+maxsize:in -> MODERATION;
 
 any:no -> truth:in;
-any:yes -> MODERATION;
+any:in -> MODERATION;
 
 truth:always -> PIPELINE [minlen=2];
}



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/fa782051077f668af7e9a90ab33c8f0d318828cd...60481a3e0376de31d0287ebae297357900b39f93

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/fa782051077f668af7e9a90ab33c8f0d318828cd...60481a3e0376de31d0287ebae297357900b39f93
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Fix graphviz complaint. Try requiring newer sphinx.

2020-08-21 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
4793cfde by Mark Sapiro at 2020-08-22T05:54:33+00:00
Fix graphviz complaint.  Try requiring newer sphinx.

- - - - -
fa782051 by Mark Sapiro at 2020-08-22T05:54:33+00:00
Merge branch 'sphinx' into 'master'

Fix graphviz complaint.  Try requiring newer sphinx.

See merge request mailman/mailman!691
- - - - -


4 changed files:

- requirements-docs.txt
- src/mailman/docs/8-miles-high.rst
- src/mailman/handlers/docs/arc_sign.rst
- src/mailman/rest/docs/addresses.rst


Changes:

=
requirements-docs.txt
=
@@ -1,4 +1,4 @@
-sphinx
+sphinx>=3.2
 sphinx_rtd_theme
 docutils==0.12
 sphinxcontrib-zopeext


=
src/mailman/docs/8-miles-high.rst
=
@@ -101,7 +101,7 @@ The default set of rules looks something like this:
 subgraph in { IN [shape=box, color=lightblue, style=filled]; }
 subgraph rules {
   rankdir=TB;
-  node [shape=record];
+  node [shape=box, style=rounded];
   approved [label=" approved | {  no |  }"];
   emergency [label=" emergency | {  no |  }"];
   loop [label=" loop | {  no |  }"];


=
src/mailman/handlers/docs/arc_sign.rst
=
@@ -33,7 +33,8 @@ test._domainkey.example.com
 
 The following is an example TXT record:
 ::
-   "v=DKIM1; k=rsa; 
p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCyBwu6PiaDN87t3DVZ84zIrEhCoxtFuv7g52oCwAUXTDnXZ+0XHM/rhkm8XSGr1yLsDc1zLGX8IfITY1dL2CzptdgyiX7vgYjzZqG368C8BtGB5m6nj26NyhSKEdlV7MS9KbASd359ggCeGTT5QjRKEMSauVyVSeapq6ZcpZ9JwQIDAQAB"
+
+"v=DKIM1; k=rsa; 
p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCyBwu6PiaDN87t3DVZ84zIrEhCoxtFuv7g52oCwAUXTDnXZ+0XHM/rhkm8XSGr1yLsDc1zLGX8IfITY1dL2CzptdgyiX7vgYjzZqG368C8BtGB5m6nj26NyhSKEdlV7MS9KbASd359ggCeGTT5QjRKEMSauVyVSeapq6ZcpZ9JwQIDAQAB"
 
 The value of the above p= tag should be the public key from your pair.
 


=
src/mailman/rest/docs/addresses.rst
=
@@ -378,6 +378,7 @@ address is unset.
 
 Setting Ram's preferred addresses requires that it first be verified:
 ::
+
 >>> 
dump_json('http://localhost:9001/3.1/users/r...@example.com/preferred_address',
 ... {'email': 'r...@example.com'})
 Traceback (most recent call last):
@@ -386,6 +387,7 @@ Setting Ram's preferred addresses requires that it first be 
verified:
 
 Verify Ram's address first:
 ::
+
 >>> addr = ram.addresses[0]
 >>> addr.verified_on = now()
 >>> transaction.commit()



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/d6c49b0f32cc17d89e78bdbed89beb9e4b9d43e2...fa782051077f668af7e9a90ab33c8f0d318828cd

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/d6c49b0f32cc17d89e78bdbed89beb9e4b9d43e2...fa782051077f668af7e9a90ab33c8f0d318828cd
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 3 commits: Handle TOCTOU error with two subscription requests of same email.

2020-08-15 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
873fcdaf by Abhilash Raj at 2020-08-09T12:24:54-07:00
Handle TOCTOU error with two subscription requests of same email.

This happens when the same address is being subscribed simultaneous and each of
them pass the "Address does not exist, so let's create it" test 
and when both
of them try to create the same address, one of them is going to fail as
database would reject the duplicate email address due to unique constraint.

It is hard to recreate the exact conditions, hence there isn't any test, but
since the exception is raised during the SubscriptionWorkflow run, we catch
blanket Exception and return a 400 bad request with the exception message.

- - - - -
49fcde76 by Abhilash Raj at 2020-08-15T23:56:33+00:00
Merge branch 'master' into 'fix-toctou'

# Conflicts:
#   src/mailman/docs/NEWS.rst
- - - - -
f1169bdd by Mark Sapiro at 2020-08-15T21:33:35-07:00
Merge branch 'maxking/mailman-fix-toctou'

- - - - -


2 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/rest/members.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -33,6 +33,8 @@ Bugs
 * Messages forwarded when content filtering removes the entire message and
   ``filter_action`` is forward now go to owners as well as moderators.
   (Closes #753)
+* Handle TOCTOU conditions when there are two simultaneous subscription
+  requests for the same email address. (Closes #748)
 
 Command line
 


=
src/mailman/rest/members.py
=
@@ -338,6 +338,9 @@ class AllMembers(_MemberBase):
 except SubscriptionPendingError:
 conflict(response, b'Subscription request already pending')
 return
+except Exception as e:
+bad_request(response, str(e))
+return
 if token is None:
 assert token_owner is TokenOwner.no_one, token_owner
 # The subscription completed.  Let's get the resulting member



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/9a661aca58487828a0448dd23f6e0d972c82e2fc...f1169bdd043e6859fb28ec6b91d0bf47e7492ffb

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/9a661aca58487828a0448dd23f6e0d972c82e2fc...f1169bdd043e6859fb28ec6b91d0bf47e7492ffb
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Include owners in filter_action forwarded messages.

2020-08-15 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
abd25a8f by Mark Sapiro at 2020-08-15T17:15:21-07:00
Include owners in filter_action forwarded messages.

- - - - -
9a661aca by Mark Sapiro at 2020-08-16T00:39:03+00:00
Merge branch 'fa_fwd' into 'master'

Include owners in filter_action forwarded messages.

Closes #753

See merge request mailman/mailman!687
- - - - -


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
=
@@ -30,6 +30,9 @@ Bugs
 * A member subscribed as a User can now be unsubscribed.  (Closes #734)
 * When a handler rejects or discards a message, it won't be delivered or
   archived anyway.  (Closes #752)
+* Messages forwarded when content filtering removes the entire message and
+  ``filter_action`` is forward now go to owners as well as moderators.
+  (Closes #753)
 
 Command line
 


=
src/mailman/handlers/mime_delete.py
=
@@ -66,7 +66,7 @@ message.
 
 """)
 subject = _('Content filter message notification')
-notice = OwnerNotification(mlist, subject, roster=mlist.moderators)
+notice = OwnerNotification(mlist, subject, roster=mlist.administrators)
 notice.set_type('multipart/mixed')
 notice.attach(MIMEText(text))
 notice.attach(MIMEMessage(msg))


=
src/mailman/handlers/tests/test_mimedel.py
=
@@ -123,12 +123,12 @@ Message-ID: 
 get_queue_messages('bad', expected_count=0)
 
 def test_dispose_forward(self):
-# The disposed message gets forwarded to the list moderators.  So
-# first add some moderators.
+# The disposed message gets forwarded to the list administrators.  So
+# first add an owner and a moderator.
 user_manager = getUtility(IUserManager)
 anne = user_manager.create_address('a...@example.com')
 bart = user_manager.create_address('b...@example.com')
-self._mlist.subscribe(anne, MemberRole.moderator)
+self._mlist.subscribe(anne, MemberRole.owner)
 self._mlist.subscribe(bart, MemberRole.moderator)
 # Now set the filter action and dispose the message.
 self._mlist.filter_action = FilterAction.forward



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/6c03227657abe8c896a3db75ceacfd7a7f7b64ff...9a661aca58487828a0448dd23f6e0d972c82e2fc

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/6c03227657abe8c896a3db75ceacfd7a7f7b64ff...9a661aca58487828a0448dd23f6e0d972c82e2fc
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: When a handler rejects or discards a message, stop the pipeline.

2020-08-15 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
dae4c7a6 by Mark Sapiro at 2020-08-15T13:40:36-07:00
When a handler rejects or discards a message, stop the pipeline.

- - - - -
6c032276 by Mark Sapiro at 2020-08-15T21:55:28+00:00
Merge branch 'pipeline' into 'master'

When a handler rejects or discards a message, stop the pipeline.

Closes #752

See merge request mailman/mailman!686
- - - - -


3 changed files:

- src/mailman/core/pipelines.py
- src/mailman/core/tests/test_pipelines.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/core/pipelines.py
=
@@ -52,11 +52,15 @@ def process(mlist, msg, msgdata, pipeline_name='built-in'):
 vlog.info(
 '{} discarded by "{}" pipeline handler "{}": {}'.format(
 message_id, pipeline_name, handler.name, error.message))
+# Stop processing the pipeline.
+break
 except RejectMessage as error:
 vlog.info(
 '{} rejected by "{}" pipeline handler "{}": {}'.format(
 message_id, pipeline_name, handler.name, str(error)))
 bounce_message(mlist, msg, error)
+# Stop processing the pipeline.
+break
 
 
 @public


=
src/mailman/core/tests/test_pipelines.py
=
@@ -22,6 +22,7 @@ import unittest
 from mailman.app.lifecycle import create_list
 from mailman.config import config
 from mailman.core.pipelines import process
+from mailman.handlers.to_outgoing import ToOutgoing
 from mailman.interfaces.handler import IHandler
 from mailman.interfaces.member import MemberRole
 from mailman.interfaces.pipeline import (
@@ -62,6 +63,7 @@ class DiscardingPipeline:
 
 def __iter__(self):
 yield DiscardingHandler()
+yield ToOutgoing()
 
 
 @implementer(IPipeline)
@@ -74,6 +76,7 @@ class RejectingPipeline:
 
 def __iter__(self):
 yield RejectHandler(self.message)
+yield ToOutgoing()
 
 
 class TestPostingPipeline(unittest.TestCase):
@@ -121,6 +124,8 @@ testing
 self.assertTrue(line.endswith(
 ' discarded by "test-discarding" pipeline handler '
 '"discarding": by test handler'))
+# There should be no outgoing message.
+get_queue_messages('out', expected_count=0)
 
 def test_rejecting_pipeline(self):
 # If a handler in the pipeline raises RejectMessage, the post will
@@ -142,6 +147,8 @@ testing
 # The first payload contains the rejection reason.
 payload = items[0].msg.get_payload(0).get_payload()
 self.assertEqual(payload, 'by test handler')
+# There should be no outgoing message.
+get_queue_messages('out', expected_count=0)
 
 def test_rejecting_pipeline_without_message(self):
 # Similar to above, but without a rejection message.
@@ -166,6 +173,8 @@ testing
 # The first payload contains the rejection reason.
 payload = items[0].msg.get_payload(0).get_payload()
 self.assertEqual(payload, '[No details are available]')
+# There should be no outgoing message.
+get_queue_messages('out', expected_count=0)
 
 def test_decorate_bulk(self):
 # Ensure that bulk postings get decorated with the footer.


=
src/mailman/docs/NEWS.rst
=
@@ -28,6 +28,8 @@ Bugs
 * Bounce probes can now be sent to a member subscribed as a User.
   (Closes #739)
 * A member subscribed as a User can now be unsubscribed.  (Closes #734)
+* When a handler rejects or discards a message, it won't be delivered or
+  archived anyway.  (Closes #752)
 
 Command line
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/fe80eab28fecda0e7e6f5fdb8b3574bb47b85a23...6c03227657abe8c896a3db75ceacfd7a7f7b64ff

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/fe80eab28fecda0e7e6f5fdb8b3574bb47b85a23...6c03227657abe8c896a3db75ceacfd7a7f7b64ff
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Use as_boolean() rather than literal 'yes' test.

2020-08-15 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
35f51dfd by Mark Sapiro at 2020-08-15T09:07:50-07:00
Use as_boolean() rather than literal 'yes' test.

- - - - -
8e9e6ef7 by Mark Sapiro at 2020-08-15T17:01:25+00:00
Merge branch 'td' into 'master'

Use as_boolean() rather than literal 'yes' test.

Closes #751

See merge request mailman/mailman!685
- - - - -


1 changed file:

- src/mailman/model/bounce.py


Changes:

=
src/mailman/model/bounce.py
=
@@ -20,6 +20,7 @@
 import logging
 import datetime
 
+from lazr.config import as_boolean
 from mailman.app.bounces import send_probe
 from mailman.app.membership import delete_member
 from mailman.app.notifications import (
@@ -186,7 +187,7 @@ class BounceProcessor:
 if member.bounce_score >= mlist.bounce_score_threshold:
 # Save bounce_score because sending probe resets it.
 saved_bounce_score = member.bounce_score
-if config.mta.verp_probes == 'yes':
+if as_boolean(config.mta.verp_probes):
 send_probe(member, message_id=event.message_id)
 action = 'sending probe'
 else:



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/761c268bb7c7c7b91d3f962e5ca45c9a8387095f...8e9e6ef759c1db7fc8e882832bceeca785e7758a

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/761c268bb7c7c7b91d3f962e5ca45c9a8387095f...8e9e6ef759c1db7fc8e882832bceeca785e7758a
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Project URLs

2020-07-29 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
45204103 by Barry Warsaw at 2020-07-28T10:28:23-07:00
Project URLs

- - - - -
cb3f3a7e by Mark Sapiro at 2020-07-29T21:03:31-07:00
Merge branch 'warsaw/mailman-project_urls'

- - - - -


1 changed file:

- setup.py


Changes:

=
setup.py
=
@@ -83,6 +83,11 @@ case second 'm'.  Any other spelling is incorrect.""",
 author_email= 'mailman-develop...@python.org',
 license = 'GPLv3',
 url = 'https://www.list.org',
+project_urls={
+'Documentation': 
'https://docs.mailman3.org/projects/mailman/en/latest/README.html',
+'Source': 'https://gitlab.com/mailman/mailman.git',
+'Tracker': 'https://gitlab.com/mailman/mailman/-/issues',
+},
 keywords= 'email',
 classifiers = [
 'Development Status :: 5 - Production/Stable',



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/7a8e38feefeaa4e15dbe8274cf2b2863b9402a10...cb3f3a7e3e982d6c192d277ddab1b489e166f0d6

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/7a8e38feefeaa4e15dbe8274cf2b2863b9402a10...cb3f3a7e3e982d6c192d277ddab1b489e166f0d6
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Enhance testing.subscribe to enable subscribing a User.

2020-07-18 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
26d2e6fc by Mark Sapiro at 2020-07-18T11:46:43-07:00
Enhance testing.subscribe to enable subscribing a User.

- - - - -
a96f9f21 by Mark Sapiro at 2020-07-18T21:30:00+00:00
Merge branch 'testing' into 'master'

Enhance testing.helpers.subscribe to enable subscribing a User.

See merge request mailman/mailman!672
- - - - -


2 changed files:

- src/mailman/app/tests/test_bounces.py
- src/mailman/testing/helpers.py


Changes:

=
src/mailman/app/tests/test_bounces.py
=
@@ -36,7 +36,6 @@ from mailman.testing.helpers import (
 LogFileMark, get_queue_messages, specialized_message_from_string as mfs,
 subscribe)
 from mailman.testing.layers import ConfigLayer
-from mailman.utilities.datetime import now
 from zope.component import getUtility
 
 
@@ -277,18 +276,14 @@ list owner at
 
 def test_send_probe_to_user(self):
 # Can we send probe to member subscribed as a user.
-user_manager = getUtility(IUserManager)
-anne = user_manager.get_user('a...@example.com')
-anne_address = user_manager.get_address('a...@example.com')
-anne_address.verified_on = now()
-anne.preferred_address = anne_address
-self._member = self._mlist.subscribe(anne, send_welcome_message=False)
+self._member = subscribe(self._mlist, 'Bart', email='b...@example.com',
+ as_user=True)
 token = send_probe(self._member, self._msg)
 items = get_queue_messages('virgin', expected_count=1)
 message = items[0].msg
 self.assertEqual(message['from'],
  'test-bounces+{0}@example.com'.format(token))
-self.assertEqual(message['to'], 'a...@example.com')
+self.assertEqual(message['to'], 'b...@example.com')
 self.assertEqual(message['subject'], 'Test mailing list probe message')
 
 def test_no_precedence_header(self):


=
src/mailman/testing/helpers.py
=
@@ -417,7 +417,8 @@ class chdir:
 
 
 @public
-def subscribe(mlist, first_name, role=MemberRole.member, email=None):
+def subscribe(mlist, first_name, role=MemberRole.member, email=None,
+  as_user=False):
 """Helper for subscribing a sample person to a mailing list.
 
 Returns the newly created member object.
@@ -432,12 +433,27 @@ def subscribe(mlist, first_name, role=MemberRole.member, 
email=None):
 address = user_manager.get_address(email)
 if address is None:
 person = user_manager.create_user(email, full_name)
-subscription_address = list(person.addresses)[0]
+set_preferred(person)
+if as_user:
+subscription_object = person
+else:
+subscription_object = person.preferred_address
 else:
-subscription_address = address
+if not as_user:
+subscription_object = address
+else:
+person = user_manager.create_user(display_name=full_name)
+person.link(address)
+set_preferred(person)
+subscription_object = person
 else:
-subscription_address = list(person.addresses)[0]
-mlist.subscribe(subscription_address, role)
+if as_user:
+if person.preferred_address is None:
+set_preferred(person)
+subscription_object = person
+else:
+subscription_object = list(person.addresses)[0]
+mlist.subscribe(subscription_object, role)
 roster = mlist.get_roster(role)
 return roster.get_member(email)
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/8b5b16b7bdaa3224e0f28693854dd40e867f84fe...a96f9f219661be01c05300a5789959fe6c5b23b8

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/8b5b16b7bdaa3224e0f28693854dd40e867f84fe...a96f9f219661be01c05300a5789959fe6c5b23b8
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: A member subscribed as a User can now be unsubscribed.

2020-07-18 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
77fbc572 by Mark Sapiro at 2020-07-17T22:44:54-07:00
A member subscribed as a User can now be unsubscribed.

- - - - -
8b5b16b7 by Mark Sapiro at 2020-07-18T18:10:38+00:00
Merge branch 'fix_734' into 'master'

A member subscribed as a User can now be unsubscribed.

Closes #734

See merge request mailman/mailman!670
- - - - -


3 changed files:

- src/mailman/app/subscriptions.py
- src/mailman/app/tests/test_unsubscriptions.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/app/subscriptions.py
=
@@ -396,7 +396,9 @@ class UnSubscriptionWorkflow(_SubscriptionWorkflowCommon):
 self.pre_approved = pre_approved
 
 def _step_subscription_checks(self):
-assert self.mlist.is_subscribed(self.subscriber)
+# XXX assert self.member is not None is sufficient, but ...
+assert (self.member is not None and
+self.mlist.is_subscribed(self.member.subscriber))
 self.push('confirmation_checks')
 
 def _step_confirmation_checks(self):


=
src/mailman/app/tests/test_unsubscriptions.py
=
@@ -26,7 +26,8 @@ from mailman.interfaces.mailinglist import SubscriptionPolicy
 from mailman.interfaces.pending import IPendings
 from mailman.interfaces.subscriptions import TokenOwner
 from mailman.interfaces.usermanager import IUserManager
-from mailman.testing.helpers import LogFileMark, get_queue_messages
+from mailman.testing.helpers import (LogFileMark, get_queue_messages,
+ set_preferred, subscribe)
 from mailman.testing.layers import ConfigLayer
 from mailman.utilities.datetime import now
 from unittest.mock import patch
@@ -95,6 +96,19 @@ class TestUnSubscriptionWorkflow(unittest.TestCase):
 self.assertRaises(AssertionError,
   workflow.run_thru, 'subscription_checks')
 
+def test_subscription_checks_for_user(self):
+# subscription_checks must pass for IUser subscribed as IAddress.
+member = subscribe(self._mlist, 'Bart')
+set_preferred(member.user)
+workflow = UnSubscriptionWorkflow(self._mlist, member.user)
+workflow.run_thru('subscription_checks')
+
+def test_subscription_checks_for_address(self):
+# subscription_checks must pass for IAddress subscribed as IUser.
+workflow = UnSubscriptionWorkflow(self._mlist,
+  self.anne.preferred_address)
+workflow.run_thru('subscription_checks')
+
 def test_confirmation_checks_open_list(self):
 # An unsubscription from an open list does not need to be confirmed or
 # moderated.


=
src/mailman/docs/NEWS.rst
=
@@ -27,6 +27,7 @@ Bugs
   surrogates.  (Closes #732)
 * Bounce probes can now be sent to a member subscribed as a User.
   (Closes #739)
+* A member subscribed as a User can now be unsubscribed.  (Closes #734)
 
 Command line
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/bbc96f7fd56a9e89ffd2cdcd6aba3ccbc19237a0...8b5b16b7bdaa3224e0f28693854dd40e867f84fe

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/bbc96f7fd56a9e89ffd2cdcd6aba3ccbc19237a0...8b5b16b7bdaa3224e0f28693854dd40e867f84fe
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Enable sending bounce probe to a member subscribed as a User.

2020-07-13 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
7872b511 by Mark Sapiro at 2020-07-13T21:41:41-07:00
Enable sending bounce probe to a member subscribed as a User.

- - - - -
bbc96f7f by Mark Sapiro at 2020-07-14T05:01:25+00:00
Merge branch 'fix_739' into 'master'

Enable sending bounce probe to a member subscribed as a User.

Closes #739

See merge request mailman/mailman!669
- - - - -


3 changed files:

- src/mailman/app/bounces.py
- src/mailman/app/tests/test_bounces.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/app/bounces.py
=
@@ -199,7 +199,7 @@ def send_probe(member, msg=None, message_id=None):
 code=member.preferred_language.code,
 )
 text = wrap(expand(template, mlist, dict(
-sender_email=member.subscriber.email,
+sender_email=member.address.email,
 # For backward compatibility.
 address=member.address.email,
 email=member.address.email,


=
src/mailman/app/tests/test_bounces.py
=
@@ -36,6 +36,7 @@ from mailman.testing.helpers import (
 LogFileMark, get_queue_messages, specialized_message_from_string as mfs,
 subscribe)
 from mailman.testing.layers import ConfigLayer
+from mailman.utilities.datetime import now
 from zope.component import getUtility
 
 
@@ -274,6 +275,22 @@ list owner at
 self.assertEqual(message['to'], 'a...@example.com')
 self.assertEqual(message['subject'], 'Test mailing list probe message')
 
+def test_send_probe_to_user(self):
+# Can we send probe to member subscribed as a user.
+user_manager = getUtility(IUserManager)
+anne = user_manager.get_user('a...@example.com')
+anne_address = user_manager.get_address('a...@example.com')
+anne_address.verified_on = now()
+anne.preferred_address = anne_address
+self._member = self._mlist.subscribe(anne, send_welcome_message=False)
+token = send_probe(self._member, self._msg)
+items = get_queue_messages('virgin', expected_count=1)
+message = items[0].msg
+self.assertEqual(message['from'],
+ 'test-bounces+{0}@example.com'.format(token))
+self.assertEqual(message['to'], 'a...@example.com')
+self.assertEqual(message['subject'], 'Test mailing list probe message')
+
 def test_no_precedence_header(self):
 # Probe messages should not have a Precedence header (LP: #808821).
 send_probe(self._member, self._msg)


=
src/mailman/docs/NEWS.rst
=
@@ -25,6 +25,8 @@ Bugs
   case.  (Closes #726)
 * Fixed ``mailman.email.message.Message.as_string`` to not return unicode
   surrogates.  (Closes #732)
+* Bounce probes can now be sent to a member subscribed as a User.
+  (Closes #739)
 
 Command line
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/e405f471815feb7513a404ee3cfac8d98c80869a...bbc96f7fd56a9e89ffd2cdcd6aba3ccbc19237a0

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/e405f471815feb7513a404ee3cfac8d98c80869a...bbc96f7fd56a9e89ffd2cdcd6aba3ccbc19237a0
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Fix mailman conf to use entire config to find sections, not just schema.

2020-06-26 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
5eb39451 by Mark Sapiro at 2020-06-26T21:06:05+00:00
Fix mailman conf to use entire config to find sections, not just schema.

- - - - -
9f458787 by Mark Sapiro at 2020-06-26T21:06:05+00:00
Merge branch 'fix_736' into 'master'

Fix mailman conf to use entire config to find sections, not just schema.

Closes #736

See merge request mailman/mailman!666
- - - - -


4 changed files:

- src/mailman/commands/cli_conf.py
- src/mailman/commands/docs/conf.rst
- src/mailman/commands/tests/test_cli_conf.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/commands/cli_conf.py
=
@@ -86,7 +86,7 @@ def conf(ctx, output, section, key):
 ctx.fail('No such section: {}'.format(section))
 # Case 3: Section is not given, key is given.
 elif section is None and key is not None:
-for current_section in sorted(config.schema._section_schemas):
+for current_section in sorted([section.name for section in config]):
 # We have to ensure that the current section actually exists
 # and that it contains the given key.
 if (_section_exists(current_section) and
@@ -97,7 +97,7 @@ def conf(ctx, output, section, key):
 # Case 4: Neither section nor key are given, just display all the
 # sections and their corresponding key/value pairs.
 elif section is None and key is None:
-for current_section in sorted(config.schema._section_schemas):
+for current_section in sorted([section.name for section in config]):
 # However, we have to make sure that the current sections and
 # key which are being looked up actually exist before trying
 # to print them.


=
src/mailman/commands/docs/conf.rst
=
@@ -54,6 +54,21 @@ key, along with the names of the corresponding sections.
 [logging.smtp] path: smtp.log
 [logging.subscribe] path: mailman.log
 [logging.vette] path: mailman.log
+[runner.archive] path: $QUEUE_DIR/$name
+[runner.bad] path: $QUEUE_DIR/$name
+[runner.bounces] path: $QUEUE_DIR/$name
+[runner.command] path: $QUEUE_DIR/$name
+[runner.digest] path: $QUEUE_DIR/$name
+[runner.in] path: $QUEUE_DIR/$name
+[runner.lmtp] path:
+[runner.nntp] path: $QUEUE_DIR/$name
+[runner.out] path: $QUEUE_DIR/$name
+[runner.pipeline] path: $QUEUE_DIR/$name
+[runner.rest] path:
+[runner.retry] path: $QUEUE_DIR/$name
+[runner.shunt] path: $QUEUE_DIR/$name
+[runner.virgin] path: $QUEUE_DIR/$name
+
 
 If you specify both a section and a key, you will get the corresponding value.
 


=
src/mailman/commands/tests/test_cli_conf.py
=
@@ -21,6 +21,7 @@ import unittest
 
 from click.testing import CliRunner
 from mailman.commands.cli_conf import conf
+from mailman.config import config
 from mailman.testing.layers import ConfigLayer
 from tempfile import NamedTemporaryFile
 
@@ -62,6 +63,15 @@ class TestConf(unittest.TestCase):
 'Try \'conf --help\' for help.\n\n'
 'Error: Section mailman: No such key: thiskeydoesnotexist\n')
 
+def test_pushed_section_is_found(self):
+config.push('test config', """\
+[archiver.other]
+enable: yes
+""")
+result = self._command.invoke(conf, ('-k', 'enable'))
+self.assertIn('[archiver.other] enable: yes', result.output)
+config.pop('test config')
+
 def test_output_to_explicit_stdout(self):
 result = self._command.invoke(
 conf, ('-o', '-', '-s', 'shell', '-k', 'use_ipython'))


=
src/mailman/docs/NEWS.rst
=
@@ -32,6 +32,9 @@ Command line
   subcommands have been added.  These provide more options and controls than
   the corresponding ``mailman members`` modes which are now deprecated.
   (Closes #686)
+* The ``mailman conf`` command without a ``-s/--section`` argument will now
+  show sections defined only in mailman.cfg in addition to those from
+  schema.cfg.  (Closes #736)
 
 REST
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/6adae1b2fe287d47b9fd2d73cd123c84c60e...9f45878796f6db2968171375193b5fb5d2a0ff86

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/6adae1b2fe287d47b9fd2d73cd123c84c60e...9f45878796f6db2968171375193b5fb5d2a0ff86
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Fix mailman.email.message.Message.as_string() to not return surrogates.

2020-06-17 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
9209030a by Mark Sapiro at 2020-06-17T21:10:47-07:00
Fix mailman.email.message.Message.as_string() to not return surrogates.

- - - - -
8cb56116 by Mark Sapiro at 2020-06-18T04:24:52+00:00
Merge branch 'fix_732' into 'master'

Fix mailman.email.message.Message.as_string() to not return surrogates.

Closes #732

See merge request mailman/mailman!665
- - - - -


4 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/email/message.py
- + src/mailman/email/tests/data/bad_email_4.eml
- src/mailman/email/tests/test_message.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -23,6 +23,8 @@ Bugs
   (Closes #725)
 * The ``dmarc`` rule no longer misses if DNS returns a name containing upper
   case.  (Closes #726)
+* Fixed ``mailman.email.message.Message.as_string`` to not return unicode
+  surrogates.  (Closes #732)
 
 Command line
 


=
src/mailman/email/message.py
=
@@ -55,7 +55,8 @@ class Message(email.message.Message):
 except (KeyError, LookupError, UnicodeEncodeError):
 value = email.message.Message.as_bytes(self).decode(
 'ascii', 'replace')
-return value
+# Also ensure no unicode surrogates in the returned string.
+return email.utils._sanitize(value)
 
 @property
 def sender(self):


=
src/mailman/email/tests/data/bad_email_4.eml
=
@@ -0,0 +1,23 @@
+From: u...@example.com
+To: l...@example.com
+Subject: Test Message
+Message-ID: 
+MIME-Version: 1.0
+Content-Type: multipart/alternative; boundary="zzz123"
+
+Ce message est au format MIME. Comme votre logiciel de courrier ne comprend
+pas ce format, tout ou partie de ce message pourrait être illisible..
+
+--zzz123
+Content-Type: text/plain; charset="us-ascii"
+Content-Transfer-Encoding: 7bit
+
+Plain Text
+
+--zzz123
+Content-Type: text/html; charset="us-ascii"
+Content-Transfer-Encoding: 7bit
+
+Not really HTML
+
+--zzz123--


=
src/mailman/email/tests/test_message.py
=
@@ -22,6 +22,7 @@ import unittest
 from email import message_from_binary_file
 from email.header import Header
 from email.parser import FeedParser
+from email.utils import _has_surrogates
 from importlib_resources import path
 from mailman.app.lifecycle import create_list
 from mailman.email.message import Message, UserNotification
@@ -121,6 +122,12 @@ Test content
 text = fp.read().decode('ascii', 'replace')
 self.assertEqual(msg.as_string(), text)
 
+def test_as_string_unicode_surrogates(self):
+with path('mailman.email.tests.data', 'bad_email_4.eml') as email_path:
+with open(str(email_path), 'rb') as fp:
+msg = message_from_binary_file(fp, Message)
+self.assertFalse(_has_surrogates(msg.as_string()))
+
 def test_bogus_content_charset(self):
 with path('mailman.email.tests.data', 'bad_email_3.eml') as email_path:
 with open(str(email_path), 'rb') as fp:



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/6b276b9cfc3d5580f2cfb48a6aacd78541ff443b...8cb5611662490dd154d2f4e6dbbe2b4aa3adb596

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/6b276b9cfc3d5580f2cfb48a6aacd78541ff443b...8cb5611662490dd154d2f4e6dbbe2b4aa3adb596
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Fix title and description of delmembers command.

2020-06-13 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
4bedbdb2 by Mark Sapiro at 2020-06-13T18:11:44-07:00
Fix title and description of delmembers command.

- - - - -
c20dab58 by Mark Sapiro at 2020-06-14T01:26:12+00:00
Merge branch 'docs' into 'master'

Fix title and description of delmembers command.

See merge request mailman/mailman!663
- - - - -


1 changed file:

- src/mailman/commands/docs/delmembers.rst


Changes:

=
src/mailman/commands/docs/delmembers.rst
=
@@ -1,9 +1,9 @@
 
-Managing members
+Deleting members
 
 
-The ``mailman members`` command allows a site administrator to display, add,
-and delete members from a mailing list.
+The ``mailman delmembers`` command allows a site administrator to delete 
members
+from a mailing list.
 
 >>> command = cli('mailman.commands.cli_delmembers.delmembers')
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/863de88bd98a798274d66b1614309dcf344113c5...c20dab588cb441fea6e82e810687e33ab4df216e

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/863de88bd98a798274d66b1614309dcf344113c5...c20dab588cb441fea6e82e810687e33ab4df216e
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Add option to list membership containing only addresses and not display names.

2020-06-01 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
39f5bf70 by Peter Williams at 2020-06-02T02:41:31+00:00
Add option to list membership containing only addresses and not display names.

- - - - -
d5139fad by Mark Sapiro at 2020-06-02T02:41:31+00:00
Merge branch 'patch-1' into 'master'

Add option to list membership containing only addresses and not display names.

See merge request mailman/mailman!656
- - - - -


2 changed files:

- src/mailman/commands/cli_members.py
- src/mailman/commands/tests/test_cli_members.py


Changes:

=
src/mailman/commands/cli_members.py
=
@@ -39,7 +39,8 @@ from zope.component import getUtility
 from zope.interface import implementer
 
 
-def display_members(ctx, mlist, role, regular, digest, nomail, outfp):
+def display_members(ctx, mlist, role, regular, digest,
+nomail, outfp, email_only):
 # Which type of digest recipients should we display?
 if digest == 'any':
 digest_types = [
@@ -103,8 +104,11 @@ def display_members(ctx, mlist, role, regular, digest, 
nomail, outfp):
 member = roster.get_member(address.email)
 if member.delivery_status not in status_types:
 continue
-print(formataddr((address.display_name, address.original_email)),
-  file=outfp)
+if email_only:
+print(address.original_email, file=outfp)
+else:
+print(formataddr((address.display_name, address.original_email)),
+  file=outfp)
 
 
 @transactional
@@ -294,6 +298,12 @@ def sync_members(mlist, sync_infp, no_change):
 is_flag=True, default=False,
 help=_("""\
 [output filter] Display only regular delivery members."""))
+@click.option(
+'--email-only', '-e', 'email_only',
+is_flag=True, default=False,
+help=("""\
+[output filter] Display member addresses only, without the display name.
+"""))
 @click.option(
 '--no-change', '-N', 'no_change',
 is_flag=True, default=False,
@@ -324,7 +334,7 @@ def sync_members(mlist, sync_infp, no_change):
 @click.argument('listspec')
 @click.pass_context
 def members(ctx, add_infp, del_infp, sync_infp, outfp,
-role, regular, no_change, digest, nomail, listspec):
+role, regular, no_change, digest, nomail, listspec, email_only):
 mlist = getUtility(IListManager).get(listspec)
 if mlist is None:
 ctx.fail(_('No such list: $listspec'))
@@ -335,7 +345,8 @@ def members(ctx, add_infp, del_infp, sync_infp, outfp,
 elif sync_infp is not None:
 sync_members(mlist, sync_infp, no_change)
 else:
-display_members(ctx, mlist, role, regular, digest, nomail, outfp)
+display_members(ctx, mlist, role, regular,
+digest, nomail, outfp, email_only)
 
 
 @public


=
src/mailman/commands/tests/test_cli_members.py
=
@@ -321,3 +321,11 @@ class TestCLIMembers(unittest.TestCase):
 lines = infp.readlines()
 self.assertEqual(len(lines), 1)
 self.assertEqual(lines[0], 'aper...@example.com\n')
+
+def test_email_only(self):
+subscribe(self._mlist, 'Anne')
+subscribe(self._mlist, 'Bart')
+result = self._command.invoke(members, (
+'--email-only', 'ant.example.com'))
+self.assertEqual(result.output,
+ 'aper...@example.com\nbper...@example.com\n')



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/576407f2ba024b4b05466127aabd4b384a4fcb61...d5139fad36a14607e75cca0867783eb05e877834

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/576407f2ba024b4b05466127aabd4b384a4fcb61...d5139fad36a14607e75cca0867783eb05e877834
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Extend DMARC case insensitivity to CNAMEs.

2020-05-28 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
4e54fc22 by Mark Sapiro at 2020-05-28T14:16:08-07:00
Extend DMARC case insensitivity to CNAMEs.

- - - - -
576407f2 by Mark Sapiro at 2020-05-28T21:28:53+00:00
Merge branch 'fix_726' into 'master'

Extend DMARC case insensitivity to CNAMEs.

See merge request mailman/mailman!655
- - - - -


2 changed files:

- src/mailman/rules/dmarc.py
- src/mailman/rules/tests/test_dmarc.py


Changes:

=
src/mailman/rules/dmarc.py
=
@@ -207,17 +207,17 @@ def is_reject_or_quarantine(mlist, email, dmarc_domain, 
org=False):
 # Check all the TXT records returned by DNS.  Keep track of the CNAMEs for
 # checking later on.  Ignore any other non-TXT records.
 for txt_rec in txt_recs.response.answer:
+# Don't be fooled by an answer with uppercase in the name.
+name = txt_rec.name.to_text().lower()
 if txt_rec.rdtype == dns.rdatatype.CNAME:
-cnames[txt_rec.name.to_text()] = (
+cnames[name] = (
 txt_rec.items[0].target.to_text())
 if txt_rec.rdtype != dns.rdatatype.TXT:
 continue
 result = EMPTYSTRING.join(
 str(record, encoding='utf-8')
 for record in txt_rec.items[0].strings)
-name = txt_rec.name.to_text()
-# Don't be fooled by an answer with uppercase in the name.
-results_by_name.setdefault(name.lower(), []).append(result)
+results_by_name.setdefault(name, []).append(result)
 expands = list(want_names)
 seen = set(expands)
 while expands:


=
src/mailman/rules/tests/test_dmarc.py
=
@@ -51,7 +51,9 @@ def get_dns_resolver(
 cmult=False,
 cloop=False,
 cmiss=False,
-ucase=False):
+ucase=False,
+cnmok=False,
+cnuc=False):
 """Create a dns.resolver.Resolver mock.
 
 This is used to return a predictable response to a _dmarc query.  It
@@ -143,6 +145,32 @@ def get_dns_resolver(
 self.answer = [Ans_e(), Ans_e(rdata=b'v=DMARC1; p=none;')]
 elif ucase:
 self.answer = [Ans_e(name='_dmarc.EXAMPLE.biz.')]
+elif cnmok:
+self.answer = [
+Ans_e(
+rtype=CNAME,
+name='_dmarc.example.biz.',
+cname='_dmarc.example.net.'
+),
+Ans_e(
+rtype=TXT,
+name='_dmarc.example.net.',
+rdata=b'v=DMARC1; p=reject;'
+),
+]
+elif cnuc:
+self.answer = [
+Ans_e(
+rtype=CNAME,
+name='_dmarc.EXAMPLE.biz.',
+cname='_dmarc.example.net.'
+),
+Ans_e(
+rtype=TXT,
+name='_dmarc.example.net.',
+rdata=b'v=DMARC1; p=reject;'
+),
+]
 else:
 self.answer = [Ans_e()]
 
@@ -209,6 +237,21 @@ class TestDMARCRules(TestCase):
 dmarc.get_organizational_domain('ssub.sub.city.kobe.jp'),
 'city.kobe.jp')
 
+def test_straightforward_cname(self):
+# Test that we can recognize an answer with case mismatch in the
+# domain.
+mlist = create_list('a...@example.com')
+# Use action reject.  The rule only hits on reject and discard.
+mlist.dmarc_mitigate_action = DMARCMitigateAction.reject
+msg = mfs("""\
+From: a...@example.biz
+To: a...@example.com
+
+""")
+rule = dmarc.DMARCMitigation()
+with get_dns_resolver(cnmok=True):
+self.assertTrue(rule.check(mlist, msg, {}))
+
 def test_uppercase_in_returned_domain(self):
 # Test that we can recognize an answer with case mismatch in the
 # domain.
@@ -224,6 +267,21 @@ To: a...@example.com
 with get_dns_resolver(ucase=True):
 self.assertTrue(rule.check(mlist, msg, {}))
 
+def test_uppercase_in_returned_cname(self):
+# Test that we can recognize an answer with case mismatch in the
+# domain.
+mlist = create_list('a...@example.com')
+# Use action reject.  The rule only hits on reject and discard.
+mlist.dmarc_mitigate_action = DMARCMitigateAction.reject
+msg = mfs("""\
+From: a...@example.biz
+To: a...@example.com
+
+""")
+rule = dmarc.DMARCMitigation()
+with get_dns_resolver(cnuc=True):
+self.assertTrue(rule.check(mlist, msg, {}))
+
 def test_no_at_sign_in_from_address(self):
 # If there's no @ sign in the From: address, the rule can't hit.
 ml

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Fix dmarc rule case sensitivity.

2020-05-28 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
0efc831a by Mark Sapiro at 2020-05-28T13:07:33-07:00
Fix dmarc rule case sensitivity.

- - - - -
9ecad5a6 by Mark Sapiro at 2020-05-28T20:19:31+00:00
Merge branch 'fix_726' into 'master'

Fix dmarc rule case sensitivity.

Closes #726

See merge request mailman/mailman!654
- - - - -


3 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/rules/dmarc.py
- src/mailman/rules/tests/test_dmarc.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -21,6 +21,8 @@ Bugs
 * Bounce probes are now encoded in the correct charset.  (Closes #712)
 * We now unfold address containing headers before parsing in avoid_duplicates.
   (Closes #725)
+* The ``dmarc`` rule no longer misses if DNS returns a name containing upper
+  case.  (Closes #726)
 
 
 REST


=
src/mailman/rules/dmarc.py
=
@@ -216,7 +216,8 @@ def is_reject_or_quarantine(mlist, email, dmarc_domain, 
org=False):
 str(record, encoding='utf-8')
 for record in txt_rec.items[0].strings)
 name = txt_rec.name.to_text()
-results_by_name.setdefault(name, []).append(result)
+# Don't be fooled by an answer with uppercase in the name.
+results_by_name.setdefault(name.lower(), []).append(result)
 expands = list(want_names)
 seen = set(expands)
 while expands:


=
src/mailman/rules/tests/test_dmarc.py
=
@@ -50,7 +50,8 @@ def get_dns_resolver(
 rmult=False,
 cmult=False,
 cloop=False,
-cmiss=False):
+cmiss=False,
+ucase=False):
 """Create a dns.resolver.Resolver mock.
 
 This is used to return a predictable response to a _dmarc query.  It
@@ -140,6 +141,8 @@ def get_dns_resolver(
 ]
 elif rmult:
 self.answer = [Ans_e(), Ans_e(rdata=b'v=DMARC1; p=none;')]
+elif ucase:
+self.answer = [Ans_e(name='_dmarc.EXAMPLE.biz.')]
 else:
 self.answer = [Ans_e()]
 
@@ -206,6 +209,21 @@ class TestDMARCRules(TestCase):
 dmarc.get_organizational_domain('ssub.sub.city.kobe.jp'),
 'city.kobe.jp')
 
+def test_uppercase_in_returned_domain(self):
+# Test that we can recognize an answer with case mismatch in the
+# domain.
+mlist = create_list('a...@example.com')
+# Use action reject.  The rule only hits on reject and discard.
+mlist.dmarc_mitigate_action = DMARCMitigateAction.reject
+msg = mfs("""\
+From: a...@example.biz
+To: a...@example.com
+
+""")
+rule = dmarc.DMARCMitigation()
+with get_dns_resolver(ucase=True):
+self.assertTrue(rule.check(mlist, msg, {}))
+
 def test_no_at_sign_in_from_address(self):
 # If there's no @ sign in the From: address, the rule can't hit.
 mlist = create_list('a...@example.com')



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/69e48ac68eb3a731eecb376b08a7999869a85ba2...9ecad5a6af122f4f17bd720ec8ca7e4fb26759c3

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/69e48ac68eb3a731eecb376b08a7999869a85ba2...9ecad5a6af122f4f17bd720ec8ca7e4fb26759c3
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: MS Outlook is only violating a SHOULD so don't claim non-compliance.

2020-05-28 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
76b1f6dd by Mark Sapiro at 2020-05-28T11:42:46-07:00
MS Outlook is only violating a SHOULD so don't claim non-compliance.

- - - - -
69e48ac6 by Mark Sapiro at 2020-05-28T18:54:55+00:00
Merge branch 'fix_725' into 'master'

MS Outlook is only violating a SHOULD so don't claim non-compliance.

See merge request mailman/mailman!653
- - - - -


3 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/handlers/avoid_duplicates.py
- src/mailman/handlers/tests/test_avoid_duplicates.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -19,7 +19,7 @@ Bugs
   and footers.  (Closes #701)
 * RFC 2369 headers are now added to notification messages.  (Closes #710)
 * Bounce probes are now encoded in the correct charset.  (Closes #712)
-* We now appropriately parse an incorrectly folded Cc: header from MS Outlook.
+* We now unfold address containing headers before parsing in avoid_duplicates.
   (Closes #725)
 
 


=
src/mailman/handlers/avoid_duplicates.py
=
@@ -57,12 +57,13 @@ class AvoidDuplicates:
 explicit_recips = listaddrs.copy()
 # Figure out the set of explicit recipients.
 cc_addresses = {}
-# MS Outlook creates a defective message when composing with several
-# Cc addresses of the form `real name (dept) `,
-# Outlook quotes "real name (dept)" and then folds the header between
-# `name and (dept)` resulting in a header including the entry
-# '"real name\r\n (dept)" ' which is non-compliant
-# and parses incorrectly, so we "unfold" headers here.
+# We've seen messages with Cc: headers folded inside a quoted string.
+# I.e., a message composed with several Cc addresses of the form
+# 'real name (dept) ', the MUA quotes
+# "real name (dept)" and then folds the header between 'name' and
+# '(dept)' resulting in a header including the entry
+# '"real name\r\n (dept)" ' which parses incorrectly,
+# so we "unfold" headers here.
 for header in ('to', 'cc', 'resent-to', 'resent-cc'):
 hdrs_unfolded = [re.sub('[\r\n]', '', value) for value in
  msg.get_all(header, [])]


=
src/mailman/handlers/tests/test_avoid_duplicates.py
=
@@ -77,13 +77,14 @@ X-Mailman-Version: X.Y
 More things to say.
 """)
 
-def test_bogus_ms_outlook_header_folding(self):
-# MS Outlook creates a defective message when composing with several
-# Cc addresses of the form `real name (dept) `,
-# Outlook quotes "real name (dept)" and then folds the header between
-# `name and (dept)` resulting in a header including the entry
-# '"real name\r\n (dept)" ' which is non-compliant
-# and parses incorrectly.  Test our unfolding defense.
+def test_bogus_header_folding(self):
+# We've seen messages with Cc: headers folded inside a quoted string.
+# I.e., a message composed with several Cc addresses of the form
+# 'real name (dept) ', the MUA quotes
+# "real name (dept)" and then folds the header between 'name' and
+# '(dept)' resulting in a header including the entry
+# '"real name\r\n (dept)" ' which parses incorrectly,
+# This tests that we unfold properly.
 msg = mfs("""\
 From: a...@example.com
 To: a...@example.com



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/056eb0e73720ba1d0259298da6c71dc81453e6eb...69e48ac68eb3a731eecb376b08a7999869a85ba2

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/056eb0e73720ba1d0259298da6c71dc81453e6eb...69e48ac68eb3a731eecb376b08a7999869a85ba2
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Fix mime_delete to not break messages when setting non-ascii payloads.

2020-05-18 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
577e66aa by Mark Sapiro at 2020-05-18T16:23:23-07:00
Fix mime_delete to not break messages when setting non-ascii payloads.

- - - - -
1cbdb8ef by Mark Sapiro at 2020-05-18T23:35:17+00:00
Merge branch 'fix_718' into 'master'

Fix mime_delete to not break messages when setting non-ascii payloads.

Closes #718

See merge request mailman/mailman!646
- - - - -


3 changed files:

- src/mailman/handlers/docs/filtering.rst
- src/mailman/handlers/mime_delete.py
- src/mailman/handlers/tests/test_mimedel.py


Changes:

=
src/mailman/handlers/docs/filtering.rst
=
@@ -103,6 +103,7 @@ the ``multipart`` will be replaced by the subpart.
 >>> print(msg.as_string())
 From: aper...@example.com
 MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
 Content-Type: image/gif
 X-Content-Filtered-By: Mailman/MimeDel ...
 
@@ -155,6 +156,7 @@ recast as just the subpart.
 >>> print(msg.as_string())
 From: aper...@example.com
 MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
 Content-Type: image/gif
 X-Content-Filtered-By: Mailman/MimeDel ...
 
@@ -185,6 +187,8 @@ promoted to being the outer part.
 >>> process(mlist, msg, {})
 >>> print(msg.as_string())
 From: aper...@example.com
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
 Content-Type: text/plain
 X-Content-Filtered-By: Mailman/MimeDel ...
 


=
src/mailman/handlers/mime_delete.py
=
@@ -166,12 +166,13 @@ def process(mlist, msg, msgdata):
 
 def reset_payload(msg, subpart):
 # Reset payload of msg to contents of subpart, and fix up content headers
-payload = subpart.get_payload()
 if subpart.is_multipart():
-cset = None
+msg.set_payload(subpart.get_payload())
 else:
-cset = subpart.get_content_charset()
-msg.set_payload(payload, charset=cset)
+cset = subpart.get_content_charset() or 'us-ascii'
+msg.set_payload(subpart.get_payload(decode=True).decode(
+cset, errors='replace'),
+charset=cset)
 # Don't restore Content-Transfer-Encoding; set_payload sets it based
 # on the charset.
 del msg['content-type']


=
src/mailman/handlers/tests/test_mimedel.py
=
@@ -397,6 +397,37 @@ multipart/signed
 # Ensure we can flatten it.
 dummy = msg.as_bytes() # noqa: F841
 
+def test_collapse_alternatives_non_ascii_encoded(self):
+msg = mfs("""\
+From: a...@example.com
+To: t...@example.com
+Subject: Testing mpa with transfer encoded subparts
+Message-ID: 
+MIME-Version: 1.0
+Content-Type: multipart/alternative; boundary=""
+
+--
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: quoted-printable
+
+Let=E2=80=99s also consider
+
+--
+Content-Type: text/html; charset="utf-8"
+Content-Transfer-Encoding: quoted-printable
+
+Let=E2=80=99s also consider
+
+----
+""")
+process = config.handlers['mime-delete'].process
+process(self._mlist, msg, {})
+self.assertFalse(msg.is_multipart())
+self.assertEqual(msg.get_payload(decode=True),
+ b'Let\xe2\x80\x99s also consider\n')
+# Ensure we can flatten it.
+dummy = msg.as_bytes() # noqa: F841
+
 def test_reset_payload_multipart(self):
 msg = mfs("""\
 From: a...@example.com



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/7bd49cf9d1ff27870975eeaafbed79d9e3e79be8...1cbdb8ef10764537066ccbd88f1a0ff0e8f9903b

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/7bd49cf9d1ff27870975eeaafbed79d9e3e79be8...1cbdb8ef10764537066ccbd88f1a0ff0e8f9903b
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Bounce probes are now encoded in the correct charset.

2020-05-11 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
87f2c2ba by Mark Sapiro at 2020-05-11T16:51:29+00:00
Bounce probes are now encoded in the correct charset.

- - - - -
0a4cacd4 by Mark Sapiro at 2020-05-11T16:51:30+00:00
Merge branch 'fix_712' into 'master'

Bounce probes are now encoded in the correct charset.

Closes #712

See merge request mailman/mailman!636
- - - - -


4 changed files:

- src/mailman/app/bounces.py
- src/mailman/app/tests/test_bounces.py
- src/mailman/docs/NEWS.rst
- src/mailman/runners/tests/test_bounce.py


Changes:

=
src/mailman/app/bounces.py
=
@@ -230,7 +230,7 @@ def send_probe(member, msg=None, message_id=None):
 probe = UserNotification(member.address.email, probe_sender,
  subject, lang=member.preferred_language)
 probe.set_type('multipart/mixed')
-notice = MIMEText(text, _charset=mlist.preferred_language.charset)
+notice = MIMEText(text, _charset=member.preferred_language.charset)
 probe.attach(notice)
 if msg is not None:
 probe.attach(MIMEMessage(msg))


=
src/mailman/app/tests/test_bounces.py
=
@@ -342,7 +342,8 @@ $owneraddr
 send_probe(self._member, self._msg)
 items = get_queue_messages('virgin', expected_count=1)
 message = items[0].msg
-notice = message.get_payload(0).get_payload()
+notice = message.get_payload(0).get_payload(decode=True)
+notice = notice.decode(self._member.preferred_language.charset)
 self.assertMultiLineEqual(notice, """\
 blah blah blah t...@example.com a...@example.com
 test-ow...@example.com


=
src/mailman/docs/NEWS.rst
=
@@ -18,6 +18,7 @@ Bugs
 * When importing 2.1 lists, ignore CR characters added by browsers in headers
   and footers.  (Closes #701)
 * RFC 2369 headers are now added to notification messages.  (Closes #710)
+* Bounce probes are now encoded in the correct charset.  (Closes #712)
 
 
 3.3.1


=
src/mailman/runners/tests/test_bounce.py
=
@@ -26,6 +26,7 @@ from mailman.config import config
 from mailman.database.transaction import transaction
 from mailman.interfaces.bounce import (
 BounceContext, IBounceProcessor, UnrecognizedBounceDisposition)
+from mailman.interfaces.languages import ILanguageManager
 from mailman.interfaces.member import DeliveryStatus, MemberRole
 from mailman.interfaces.styles import IStyle, IStyleManager
 from mailman.interfaces.usermanager import IUserManager
@@ -112,6 +113,21 @@ Original-Recipient: rfc822; someb...@example.com
 events = list(self._processor.events)
 self.assertEqual(len(events), 0)
 
+def test_send_probe_non_ascii(self):
+# Send a pobe from an English language list to a user with non-ascii
+# preferred language.
+language_manager = getUtility(ILanguageManager)
+self._mlist.preferred_language = language_manager.get('en')
+# French charset is utf-8, but testing has it as latin-1
+french = language_manager.get('fr')
+french.charset = 'utf-8'
+self._member.address.preferences.preferred_language = french
+send_probe(self._member, self._msg)
+items = get_queue_messages('virgin', expected_count=1)
+msg = items[0].msg
+self.assertIn(b'a...@example.com',
+  msg.get_payload()[0].get_payload(decode=True))
+
 def test_verp_probe_bounce(self):
 # A VERP probe bounced.  The primary difference here is that the
 # registered bounce event will have a different context.  The



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/bde67ed83301f07f0fd01b2b0e7b7b23749e4acc...0a4cacd4a4a16649934579218e0509ecd7f46f49

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/bde67ed83301f07f0fd01b2b0e7b7b23749e4acc...0a4cacd4a4a16649934579218e0509ecd7f46f49
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: For Postfix, Mailman settings should be added to existing settings.

2020-04-30 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
ef7ddd41 by Mark Sapiro at 2020-04-30T14:25:37-07:00
For Postfix, Mailman settings should be added to existing settings.

- - - - -
daea7c45 by Mark Sapiro at 2020-04-30T21:38:31+00:00
Merge branch 'fix_doc' into 'master'

For Postfix, Mailman settings should be added to existing settings.

See merge request mailman/mailman!633
- - - - -


1 changed file:

- src/mailman/docs/mta.rst


Changes:

=
src/mailman/docs/mta.rst
=
@@ -160,7 +160,17 @@ Mailman's LMTP server, add the following to Postfix's 
``main.cf`` file::
 hash:/path-to-mailman/var/data/postfix_domains
 
 where ``path-to-mailman`` is replaced with the actual path that you're running
-Mailman from.  Setting ``local_recipient_maps`` as well as ``transport_maps``
+Mailman from.
+
+Note that in the above and also below, if your current ``main.cf`` contains
+settings for these items, including the default setting for
+``local_recipient_maps``, you should add the Mailman setting to the existing
+setting rather than replacing it.  For example::
+
+local_recipient_maps = proxy:unix:passwd.byname $alias_maps
+hash:/path-to-mailman/var/data/postfix_lmtp
+
+Setting ``local_recipient_maps`` as well as ``transport_maps``
 allows Postfix to properly reject all messages destined for non-existent local
 users.  Setting `relay_domains`_ means Postfix will start to accept mail for
 newly added domains even if they are not part of `mydestination`_.



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/1614aee43e60492e609f1159ddd7d8102abc252e...daea7c458cfe63900344e075e328a57c7b7d9926

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/1614aee43e60492e609f1159ddd7d8102abc252e...daea7c458cfe63900344e075e328a57c7b7d9926
You're receiving this email because of your account on gitlab.com.


___
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/


[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Don't import banned addresses.

2020-03-21 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
14af7e16 by Mark Sapiro at 2020-03-21T17:47:18-07:00
Don't import banned addresses.

- - - - -
a2a8d298 by Mark Sapiro at 2020-03-22T02:02:51+00:00
Merge branch 'fix_688' into 'master'

Don't import banned addresses.

Closes #688

See merge request mailman/mailman!604
- - - - -


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
=
@@ -50,6 +50,7 @@ Bugs
   library which causes Templates loading to fail. (Closes #691)
 * Fix a bug due to incompatible API of a new version of ``zope.intefaces``.
   (See !606)
+* Import21 no longer tries to import banned addresses.  (Closes #688)
 
 REST
 


=
src/mailman/utilities/importer.py
=
@@ -587,11 +587,16 @@ def _import_roster(mlist, config_dict, members, role, 
action=None):
 validator = getUtility(IEmailValidator)
 roster = mlist.get_roster(role)
 skipped = []
+banned = []
 action_arg = action
 for email in members:
 # For owners and members, the emails can have a mixed case, so
 # lowercase them all.
 email = bytes_to_str(email).lower()
+# Ignore any banned addresses for all rosters.
+if IBanManager(mlist).is_banned(email):
+banned.append((email, role))
+continue
 if roster.get_member(email) is not None:
 skipped.append((email, role))
 continue
@@ -694,3 +699,6 @@ def _import_roster(mlist, config_dict, members, role, 
action=None):
 for email, role in skipped:
 print('{} is already imported with role {}'.format(email, role),
   file=sys.stderr)
+for email, role in banned:
+print('{} is banned and not imported with role {}'.format(email, role),
+  file=sys.stderr)


=
src/mailman/utilities/tests/test_import.py
=
@@ -1176,6 +1176,15 @@ class TestRosterImport(unittest.TestCase):
 member = self._mlist.nonmembers.get_member('ho...@example.com')
 self.assertEqual(member.moderation_action, Action.hold)
 
+def test_no_import_banned_address(self):
+# Banned addresses should not be imported with any role.
+self._pckdict['ban_list'] = [b'^.*example.com']
+import_config_pck(self._mlist, self._pckdict)
+self.assertEqual([], list(self._mlist.owners.addresses))
+self.assertEqual([], list(self._mlist.moderators.addresses))
+self.assertEqual([], list(self._mlist.members.addresses))
+self.assertEqual([], list(self._mlist.nonmembers.addresses))
+
 
 class TestRosterVisibilityImport(unittest.TestCase):
 """Test that member_roster_visibility is imported correctly.



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/a3f4232a750402a5344ddb359e81a848b1177dbb...a2a8d298030b69c6d4e168669c1f2fbfe009c4f4

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/a3f4232a750402a5344ddb359e81a848b1177dbb...a2a8d298030b69c6d4e168669c1f2fbfe009c4f4
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: Fix the TemplateLoader for the new API in importlib_resources.

2020-03-09 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
d507a90a by Abhilash Raj at 2020-03-08T23:22:21-07:00
Fix the TemplateLoader for the new API in importlib_resources.

- - - - -
98274cbd by Mark Sapiro at 2020-03-09T13:29:51+00:00
Merge branch 'fix-660' into 'master'

Fix the TemplateLoader for the new API in importlib_resources.

Closes #691

See merge request mailman/mailman!605
- - - - -


5 changed files:

- setup.py
- src/mailman/docs/NEWS.rst
- src/mailman/utilities/i18n.py
- src/mailman/utilities/tests/test_modules.py
- src/mailman/utilities/tests/test_templates.py


Changes:

=
setup.py
=
@@ -115,7 +115,7 @@ case second 'm'.  Any other spelling is incorrect.""",
 'flufl.bounce',
 'flufl.i18n>=2.0',
 'flufl.lock>=3.1',
-'importlib_resources',
+'importlib_resources>=1.1.0',
 'gunicorn',
 'lazr.config',
 'python-dateutil>=2.0',


=
src/mailman/docs/NEWS.rst
=
@@ -46,6 +46,8 @@ Bugs
   that can't be flattened as_bytes.  (Closes #677)
 * Removed an incorrect failing assertion when confirming a 
confirm_then_moderate
   unsubscription.  (Closes #553)
+* Fix a bug due to incompatible API of a new version of ``importlib_resources``
+  library which causes Templates loading to fail. (Closes #691)
 
 REST
 


=
src/mailman/utilities/i18n.py
=
@@ -21,7 +21,7 @@ import os
 import sys
 
 from contextlib import ExitStack
-from importlib_resources import path
+from importlib_resources import files
 from itertools import product
 from mailman.config import config
 from mailman.core.constants import system_preferences
@@ -114,7 +114,7 @@ def search(resources, template_file, mlist=None, 
language=None):
 languages.append(language)
 languages.reverse()
 # The non-language qualified $template_dir paths in search order.
-templates_dir = str(resources.enter_context(path('mailman', 'templates')))
+templates_dir = str(resources.enter_context(files('mailman.templates')))
 paths = [templates_dir, os.path.join(config.TEMPLATE_DIR, 'site')]
 if mlist is not None:
 # Don't forget these are in REVERSE search order!


=
src/mailman/utilities/tests/test_modules.py
=
@@ -22,7 +22,7 @@ import sys
 import unittest
 
 from contextlib import ExitStack, contextmanager
-from importlib_resources import path
+from importlib_resources import files
 from mailman.interfaces.rules import IRule
 from mailman.interfaces.styles import IStyle
 from mailman.testing.helpers import configuration
@@ -162,7 +162,7 @@ class AbstractStyle:
 def test_find_pluggable_components_by_plugin_name(self):
 with ExitStack() as resources:
 testing_path = resources.enter_context(
-path('mailman.plugins.testing', ''))
+files('mailman.plugins.testing'))
 resources.enter_context(hack_syspath(0, str(testing_path)))
 resources.enter_context(configuration('plugin.example', **{
 'class': 'example.hooks.ExamplePlugin',
@@ -174,7 +174,7 @@ class AbstractStyle:
 def test_find_pluggable_components_by_component_package(self):
 with ExitStack() as resources:
 testing_path = resources.enter_context(
-path('mailman.plugins.testing', ''))
+files('mailman.plugins.testing'))
 resources.enter_context(hack_syspath(0, str(testing_path)))
 resources.enter_context(configuration('plugin.example', **{
 'class': 'example.hooks.ExamplePlugin',


=
src/mailman/utilities/tests/test_templates.py
=
@@ -23,7 +23,7 @@ import tempfile
 import unittest
 
 from contextlib import ExitStack
-from importlib_resources import path as resource_path
+from importlib_resources import files as resource_path
 from mailman.app.lifecycle import create_list
 from mailman.config import config
 from mailman.interfaces.languages import ILanguageManager
@@ -64,7 +64,7 @@ class TestSearchOrder(unittest.TestCase):
 # /m/ as the root.
 with ExitStack() as resources:
 in_tree = str(resources.enter_context(
-resource_path('mailman', 'templates')).parent)
+resource_path('mailman.templates')).parent)
 raw_search_order = search(
 resources, template_file, mailing_list, language)
 for path in raw_search_order:



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/1baf751778835692dd71d0b594c6e6caeab876cb...98274cbd03e9180e5180584ffa9f4c09396d62ef

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/1baf751778835692dd71d0b594c6e

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Removed incorrect member is None assertion when confirming a

2020-02-27 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
f0c1b412 by Mark Sapiro at 2020-02-19T14:02:43-08:00
Removed incorrect member is None assertion when confirming a
confirm_then_moderate unsubscription.

- - - - -
a9bbf529 by Mark Sapiro at 2020-02-27T16:50:06+00:00
Merge branch 'fix_553' into 'master'

Removed incorrect member is None assertion when confirming a 
confirm_then_moderate unsubscription.

Closes #553

See merge request mailman/mailman!603
- - - - -


3 changed files:

- src/mailman/commands/eml_confirm.py
- src/mailman/commands/tests/test_eml_confirm.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/commands/eml_confirm.py
=
@@ -55,14 +55,14 @@ class Confirm:
 if new_token is None:
 assert token_owner is TokenOwner.no_one, token_owner
 # We can't assert anything about member.  It will be None when
-# the workflow we're confirming is an unsubscription request,
-# and non-None when we're confirming a subscription request.
+# the workflow we're confirming is a subscription request,
+# and non-None when we're confirming an unsubscription request.
 # This class doesn't know which is happening.
 succeeded = True
 elif token_owner is TokenOwner.moderator:
-# This must have been a confirm-then-moderator subscription.
+# This must have been a confirm-then-moderate (un)subscription.
 assert new_token != token
-assert member is None, member
+# We can't assert anything about member for the above reason.
 succeeded = True
 else:
 assert token_owner is not TokenOwner.no_one, token_owner


=
src/mailman/commands/tests/test_eml_confirm.py
=
@@ -121,6 +121,25 @@ Subject: Re: confirm {token}
 member = self._mlist.members.get_member('a...@example.com')
 self.assertIsNone(member)
 
+def test_confirm_leave_moderate(self):
+msg = mfs("""\
+From: Anne Person 
+To: test-confirm+{token}@example.com
+Subject: Re: confirm {token}
+
+""".format(token=self._token))
+self._mlist.unsubscription_policy = (
+SubscriptionPolicy.confirm_then_moderate)
+# Clear any previously queued confirmation messages.
+get_queue_messages('virgin')
+Confirm().process(self._mlist, msg, {}, (self._token,), Results())
+# Anne is still a member of the mailing list.
+member = self._mlist.members.get_member('a...@example.com')
+self.assertIsNotNone(member)
+# There should be a notice to the list owners
+item = get_queue_messages('virgin', expected_count=1)[0]
+self.assertEqual(item.msg['to'], 'test-ow...@example.com')
+
 
 class TestEmailResponses(unittest.TestCase):
 """Test the `confirm` command through the command runner."""


=
src/mailman/docs/NEWS.rst
=
@@ -44,6 +44,8 @@ Bugs
 * Find members API now searches for the Member's display name too. (Closes 
#667)
 * Content filtering ``convert_html_to_plaintext`` no longer creates messages
   that can't be flattened as_bytes.  (Closes #677)
+* Removed an incorrect failing assertion when confirming a 
confirm_then_moderate
+  unsubscription.  (Closes #553)
 
 REST
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/a76a1e64ae9d86c1ec94f8e2c66742e0778f0355...a9bbf52985193314622d8737baa031588c247efc

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/a76a1e64ae9d86c1ec94f8e2c66742e0778f0355...a9bbf52985193314622d8737baa031588c247efc
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: Fixed html_to_plaintext to properly encode the new payload.

2020-02-09 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
94fbd7dd by Mark Sapiro at 2020-02-06T11:36:54-08:00
Fixed html_to_plaintext to properly encode the new payload.

Added test for same and updated existing tests for changes.

- - - - -
3af7ed0b by Mark Sapiro at 2020-02-09T17:08:14+00:00
Merge branch 'fix_677' into 'master'

Fixed html_to_plaintext to properly encode the new payload.

Closes #677

See merge request mailman/mailman!600
- - - - -


4 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/handlers/docs/filtering.rst
- src/mailman/handlers/mime_delete.py
- src/mailman/handlers/tests/test_mimedel.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -11,7 +11,7 @@ Here is a history of user visible changes to Mailman.
 3.3.1
 =
 
-(2019-XX-XX)
+(2020-XX-XX)
 
 Bugs
 
@@ -41,6 +41,8 @@ Bugs
   (Closes #665)
 * Residial bounces are now marked as processed.  (Closes #669)
 * Find members API now searches for the Member's display name too. (Closes 
#667)
+* Content filtering ``convert_html_to_plaintext`` no longer creates messages
+  that can't be flattened as_bytes.  (Closes #677)
 
 REST
 


=
src/mailman/handlers/docs/filtering.rst
=
@@ -234,8 +234,9 @@ name of the file containing the message payload to filter.
 ... process(mlist, msg, {})
 >>> print(msg.as_string())
 From: aper...@example.com
+Content-Transfer-Encoding: 7bit
 MIME-Version: 1.0
-Content-Type: text/plain
+Content-Type: text/plain; charset="us-ascii"
 X-Content-Filtered-By: Mailman/MimeDel ...
 
 Converted text/html to text/plain
@@ -301,8 +302,9 @@ so the entire inner ``multipart/mixed`` is discarded.
 X-Content-Filtered-By: Mailman/MimeDel ...
 
 --AAA
+Content-Transfer-Encoding: 7bit
 MIME-Version: 1.0
-Content-Type: text/plain
+Content-Type: text/plain; charset="us-ascii"
 
 Converted text/html to text/plain
 Filename: ...


=
src/mailman/handlers/mime_delete.py
=
@@ -274,7 +274,7 @@ def to_plaintext(msg):
 resources.callback(shutil.rmtree, tempdir)
 for subpart in typed_subpart_iterator(msg, 'text', 'html'):
 filename = os.path.join(tempdir, '{}.html'.format(next(counter)))
-ctype = msg.get_content_charset('utf-8')
+ctype = msg.get_content_charset('us-ascii')
 with open(filename, 'w', encoding='utf-8') as fp:
 fp.write(subpart.get_payload(decode=True).decode(ctype,
  errors='replace'))
@@ -288,7 +288,7 @@ def to_plaintext(msg):
 # Replace the payload of the subpart with the converted text
 # and tweak the content type.
 del subpart['content-transfer-encoding']
-subpart.set_payload(stdout)
+subpart.set_payload(stdout, charset=ctype)
 subpart.set_type('text/plain')
 changedp += 1
 return changedp


=
src/mailman/handlers/tests/test_mimedel.py
=
@@ -45,6 +45,9 @@ from zope.component import getUtility
 @contextmanager
 def dummy_script(arg=''):
 exe = sys.executable
+non_ascii = ''
+if arg == 'non-ascii':
+non_ascii = '‘...’'
 extra = ''
 if arg == 'scripterr':
 extra = 'error'
@@ -59,10 +62,10 @@ def dummy_script(arg=''):
 import sys
 if len(sys.argv) > 2:
 sys.exit(1)
-print('Converted text/html to text/plain')
+print('Converted text/html to text/plain{}')
 print('Filename:', sys.argv[1])
 print(open(sys.argv[1]).readlines()[0])
-""", file=fp)
+""".format(non_ascii), file=fp)
 config.push('dummy script', """\
 [mailman]
 html_to_plain_text_command = {exe} {script} {extra} $filename
@@ -261,6 +264,29 @@ PGh0bWw+PGhlYWQ+PC9oZWFkPgo8Ym9keT48L2JvZHk+PC9odG1sPgo=
 self.assertEqual(payload_lines[0], 'Converted text/html to text/plain')
 self.assertEqual(payload_lines[2], '')
 
+def test_convert_html_to_plaintext_encodes_new_payload(self):
+# Test that the converted payload with non-ascii is encoded.
+msg = mfs("""\
+From: aper...@example.com
+Content-Type: text/html; charset=utf-8
+Content-Transfer-Encoding: base64
+MIME-Version: 1.0
+
+Q29udmVydGVkIHRleHQvaHRtbCB0byB0ZXh0L3BsYWlu4oCYLi4u4oCZCg==
+""")
+process = config.handlers['mime-delete'].process
+with dummy_script('non-ascii'):
+process(self._mlist, msg, {})
+self.assertEqual(msg['content-type'], 'text/plain; charset="utf-8"')
+self.assertEqual(msg['content-transfer-encoding'], 'base64')
+self.assertTrue(
+msg['x-content-filtered-by'].startswith('Mailman/MimeDel'))
+payload_lines = (
+msg.get_payl

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Update conf.py . I think parentheses were missing .Parentheses are added in the commit.

2020-02-06 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
a383e29b by kushal kothari at 2020-02-06T19:48:58+00:00
Update conf.py  . I think parentheses were missing .Parentheses are added in 
the commit.

- - - - -
bb36d44c by Mark Sapiro at 2020-02-06T19:48:59+00:00
Merge branch 'master' into 'master'

Update conf.py  . I think parentheses were missing .Parentheses are added in 
the commit.

See merge request mailman/mailman!599
- - - - -


1 changed file:

- conf.py


Changes:

=
conf.py
=
@@ -239,7 +239,7 @@ def index_html():
 os.chdir('build/sphinx/html')
 try:
 os.symlink('README.html', 'index.html')
-print 'index.html -> README.html'
+print('index.html -> README.html')
 except OSError as error:
 if error.errno != errno.EEXIST:
 raise



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/eeecdbaa268bb85f09f446dc672da6d49e94a932...bb36d44c1248344b97b82d823c8fcbe3f3e2df96

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/eeecdbaa268bb85f09f446dc672da6d49e94a932...bb36d44c1248344b97b82d823c8fcbe3f3e2df96
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] 3 commits: Fix the name of the queue directory in inject help.

2019-12-21 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
47bf959d by Mark Sapiro at 2019-12-21T13:31:15-08:00
Fix the name of the queue directory in inject help.

- - - - -
ff2f396b by Mark Sapiro at 2019-12-21T15:21:22-08:00
Minor moving of pragma: nocover so diffcov succeeds.

- - - - -
abf6f47c by Mark Sapiro at 2019-12-21T23:32:44+00:00
Merge branch 'fix_656' into 'master'

Fix the name of the queue directory in inject help.

Closes #656

See merge request mailman/mailman!581
- - - - -


2 changed files:

- src/mailman/commands/cli_inject.py
- src/mailman/commands/cli_members.py


Changes:

=
src/mailman/commands/cli_inject.py
=
@@ -47,7 +47,7 @@ def show_queues(ctx, param, value):
 '--queue', '-q',
 help=_("""\
 The name of the queue to inject the message to.  QUEUE must be one of the
-directories inside the qfiles directory.  If omitted, the incoming queue is
+directories inside the queue directory.  If omitted, the incoming queue is
 used."""))
 @click.option(
 '--show', '-s',


=
src/mailman/commands/cli_members.py
=
@@ -114,17 +114,18 @@ def add_members(mlist, add_infp):
 continue
 # Parse the line and ensure that the values are unicodes.
 display_name, email = parseaddr(line)
-if email == '':   # pragma: nocover
-line = line.strip()   # pragma: nocover
+if email == '':
+line = line.strip()
 print(_('Cannot parse as valid email address (skipping): $line'),
-  file=sys.stderr)# pragma: nocover
-continue  # pragma: nocover
+  file=sys.stderr)
+continue
 try:
 add_member(mlist,
RequestRecord(email, display_name,
  DeliveryMode.regular,
  mlist.preferred_language.code))
-except InvalidEmailAddressError:
+except InvalidEmailAddressError:# pragma: nocover
+# There is a test for this, but it hits the if email == '' above.
 # It's okay if the address is invalid, we print a warning and
 # continue.
 line = line.strip()



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/43a91e9d65dd6a15c7e71d45ceb209f050ab7e3e...abf6f47c0b484bbb927df7becdb797e89677729c

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/43a91e9d65dd6a15c7e71d45ceb209f050ab7e3e...abf6f47c0b484bbb927df7becdb797e89677729c
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: simple typo in src/mailman/commands/docs/notify.rst

2019-12-04 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
2d4000a0 by Jack DuGard at 2019-12-04T22:22:06Z
simple typo in src/mailman/commands/docs/notify.rst

- - - - -
0698bfcd by Mark Sapiro at 2019-12-04T22:22:07Z
Merge branch 'Uriel323-master-patch-73729' into 'master'

simple typo in src/mailman/commands/docs/notify.rst

See merge request mailman/mailman!578
- - - - -


1 changed file:

- src/mailman/commands/docs/notify.rst


Changes:

=
src/mailman/commands/docs/notify.rst
=
@@ -7,7 +7,7 @@ cron to send a notice summarizing pending subscriptions, 
unsubscriptions and
 held messages waiting moderator approval to a list's owners and moderators.
 
 There are options for doing selected lists and reporting but not actually
-senting the notices.  Complete information about command options may be
+sending the notices.  Complete information about command options may be
 obtained by running ``mailman notify --help``.
 ::
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/997f383ec310fa7f04b6114584d9f49b67d65eca...0698bfcd331b6df733e4ffad1bd9e41a0dba344f

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/997f383ec310fa7f04b6114584d9f49b67d65eca...0698bfcd331b6df733e4ffad1bd9e41a0dba344f
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: Fixed example in handlers/docs/arc_sign.rst.

2019-11-09 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
6a3aff13 by Mark Sapiro at 2019-11-09T19:43:34Z
Fixed example in handlers/docs/arc_sign.rst.

- - - - -
9717f50e by Mark Sapiro at 2019-11-09T20:34:56Z
Merge branch 'fix_648' into 'master'

Fixed example in handlers/docs/arc_sign.rst.

Closes #648

See merge request mailman/mailman!575
- - - - -


1 changed file:

- src/mailman/handlers/docs/arc_sign.rst


Changes:

=
src/mailman/handlers/docs/arc_sign.rst
=
@@ -25,9 +25,11 @@ can be specified in ``mailman.cfg``::
 
 The public key should be put into a DNS TXT record, and located at:
 
-#{config.ARC.selector}._domainkeys.#{config.ARC.domain}
---ex.--
-test._domainkeys.example.com
+#{config.ARC.selector}._domainkey.#{config.ARC.domain}
+
+For example:
+
+test._domainkey.example.com
 
 The following is an example TXT record:
 ::



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/e2df0a97013bb360429c295700c9e30eee6cace5...9717f50e3c12c799dc1252fdc4a21ad06844549c

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/e2df0a97013bb360429c295700c9e30eee6cace5...9717f50e3c12c799dc1252fdc4a21ad06844549c
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: Updated copyright year and history paragraph for current status.

2019-10-21 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
231393a3 by Mark Sapiro at 2019-10-20T23:56:15Z
Updated copyright year and history paragraph for current status.

- - - - -
e2df0a97 by Mark Sapiro at 2019-10-21T23:27:24Z
Merge branch 'intro' into 'master'

Updated docs/introduction.rst copyright year and history paragraph for current 
status.

See merge request mailman/mailman!574
- - - - -


1 changed file:

- src/mailman/docs/introduction.rst


Changes:

=
src/mailman/docs/introduction.rst
=
@@ -34,7 +34,7 @@ But we really like Postorius and HyperKitty and hope you will 
too!
 Copyright
 =
 
-Copyright 1998-2018 by the Free Software Foundation, Inc.
+Copyright 1998-2019 by the Free Software Foundation, Inc.
 
 This file is part of GNU Mailman.
 
@@ -70,10 +70,10 @@ Viega.  Since version 1.0 the project has been led by Barry 
Warsaw with
 contributions from many; see the `ACKNOWLEDGMENTS`_ file for details.  Jeremy
 Hylton helped considerably with the Pipermail code in Mailman 2.0.  Mailman
 2.1 is primarily maintained by Mark Sapiro, with previous help by Tokio
-Kikuchi (RIP).  Barry Warsaw is the lead developer on Mailman 3.  Aurélien
-Bompard and Florian Fuchs lead development of Postorius and HyperKitty.
-Abhilash Raj is a core developer contributing to all the bits and maintains
-the CI infrastructure.
+Kikuchi (RIP).  Mark also contributes to Mailman 3.  Barry Warsaw recently
+(2019) retired as the lead developer on Mailman 3.  Abhilash Raj is now the
+lead developer and also maintains the CI infrastructure.  Aurélien Bompard
+and Florian Fuchs lead development of Postorius and HyperKitty.
 
 
 Project details



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/03f52f338762eb23cce01b383ca2fe8406eb0729...e2df0a97013bb360429c295700c9e30eee6cace5

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/03f52f338762eb23cce01b383ca2fe8406eb0729...e2df0a97013bb360429c295700c9e30eee6cace5
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: Catch MembershipIsBannedError in eml_confirm.py.

2019-10-19 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
34ed380d by Mark Sapiro at 2019-10-18T22:46:33Z
Catch MembershipIsBannedError in eml_confirm.py.

- - - - -
03f52f33 by Mark Sapiro at 2019-10-20T03:56:33Z
Merge branch 'fix_643' into 'master'

Catch MembershipIsBannedError in eml_confirm.py.

Closes #643

See merge request mailman/mailman!573
- - - - -


3 changed files:

- src/mailman/commands/eml_confirm.py
- src/mailman/commands/tests/test_eml_confirm.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/commands/eml_confirm.py
=
@@ -19,6 +19,7 @@
 
 from mailman.core.i18n import _
 from mailman.interfaces.command import ContinueProcessing, IEmailCommand
+from mailman.interfaces.member import MembershipIsBannedError
 from mailman.interfaces.subscriptions import ISubscriptionManager, TokenOwner
 from public import public
 from zope.interface import implementer
@@ -70,6 +71,9 @@ class Confirm:
 except LookupError:
 # The token must not exist in the database.
 succeeded = False
+except MembershipIsBannedError as e:
+print(str(e), file=results)
+return ContinueProcessing.no
 if succeeded:
 print(_('Confirmed'), file=results)
 # After the 'confirm' command, do not process any other commands in


=
src/mailman/commands/tests/test_eml_confirm.py
=
@@ -23,6 +23,7 @@ from mailman.app.lifecycle import create_list
 from mailman.commands.eml_confirm import Confirm
 from mailman.config import config
 from mailman.email.message import Message
+from mailman.interfaces.bans import IBanManager
 from mailman.interfaces.command import ContinueProcessing
 from mailman.interfaces.mailinglist import SubscriptionPolicy
 from mailman.interfaces.subscriptions import ISubscriptionManager
@@ -83,6 +84,19 @@ class TestConfirmJoin(unittest.TestCase):
 self._mlist, Message(), {}, (self._token,), result)
 self.assertEqual(status, ContinueProcessing.no)
 
+def test_confirm_banned_address(self):
+# Confirmation of a banned address should return an appropriate error.
+IBanManager(self._mlist).ban('a...@example.com')
+result = Results()
+status = self._command.process(
+self._mlist, Message(), {}, (self._token,), result)
+self.assertEqual(status, ContinueProcessing.no)
+# Anne will not be subscribed.
+self.assertFalse(self._mlist.is_subscribed('a...@example.com'))
+# The result will contain an error message.
+self.assertIn('a...@example.com is not allowed to subscribe to '
+  't...@example.com', str(result))
+
 
 class TestConfirmLeave(unittest.TestCase):
 """Test the `confirm` command when leaving a mailing list."""


=
src/mailman/docs/NEWS.rst
=
@@ -21,6 +21,9 @@ Bugs
   list throwing a KeyError has been fixed.  (Closes #639)
 * Confirmation or moderator approval of a subscription from an address banned
   subsequent to subscribing will no longer succeed.  (Closes #642)
+* Fixed an issue caused by the fix for #642 where email confirmation of a
+  banned subscription address would cause a shunted message.  (Closes #643)
+
 
 3.3.0 -- "Tom Sawyer"
 =



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/faa74e7cfd1c0fc5ef9404e83a45f7fd8014ca3b...03f52f338762eb23cce01b383ca2fe8406eb0729

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/faa74e7cfd1c0fc5ef9404e83a45f7fd8014ca3b...03f52f338762eb23cce01b383ca2fe8406eb0729
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] 3 commits: Stop confirmation or approval of a banned address.

2019-10-18 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
41b175d5 by Mark Sapiro at 2019-10-18T02:08:38Z
Stop confirmation or approval of a banned address.

- - - - -
fc183b5b by Mark Sapiro at 2019-10-18T04:19:10Z
Added/changed tests for commit 41b175d57be

- - - - -
faa74e7c by Mark Sapiro at 2019-10-18T20:34:39Z
Merge branch 'fix_642' into 'master'

Stop confirmation or approval of a banned address.

Closes #642

See merge request mailman/mailman!572
- - - - -


4 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/model/mailinglist.py
- src/mailman/model/tests/test_mailinglist.py
- src/mailman/utilities/tests/test_import.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -19,6 +19,8 @@ Bugs
   to give it a moderaction of discard.  (Closes #633)
 * The issue of posting a message without a To: header to a fully personalized
   list throwing a KeyError has been fixed.  (Closes #639)
+* Confirmation or moderator approval of a subscription from an address banned
+  subsequent to subscribing will no longer succeed.  (Closes #642)
 
 3.3.0 -- "Tom Sawyer"
 =


=
src/mailman/model/mailinglist.py
=
@@ -27,6 +27,7 @@ from mailman.interfaces.action import Action, FilterAction
 from mailman.interfaces.address import IAddress, InvalidEmailAddressError
 from mailman.interfaces.archiver import ArchivePolicy
 from mailman.interfaces.autorespond import ResponseAction
+from mailman.interfaces.bans import IBanManager
 from mailman.interfaces.bounce import UnrecognizedBounceDisposition
 from mailman.interfaces.digests import DigestFrequency
 from mailman.interfaces.domain import IDomainManager
@@ -36,8 +37,8 @@ from mailman.interfaces.mailinglist import (
 IHeaderMatch, IHeaderMatchList, IListArchiver, IListArchiverSet,
 IMailingList, Personalization, ReplyToMunging, SubscriptionPolicy)
 from mailman.interfaces.member import (
-AlreadySubscribedError, MemberRole, MissingPreferredAddressError,
-SubscriptionEvent)
+AlreadySubscribedError, MemberRole, MembershipIsBannedError,
+MissingPreferredAddressError, SubscriptionEvent)
 from mailman.interfaces.mime import FilterType
 from mailman.interfaces.nntp import NewsgroupModeration
 from mailman.interfaces.user import IUser
@@ -493,6 +494,8 @@ class MailingList(Model):
 raise InvalidEmailAddressError('List posting address not allowed')
 if member is not None:
 raise AlreadySubscribedError(self.fqdn_listname, email, role)
+if IBanManager(self).is_banned(test_email):
+raise MembershipIsBannedError(self, test_email)
 member = Member(role=role,
 list_id=self._list_id,
 subscriber=subscriber)


=
src/mailman/model/tests/test_mailinglist.py
=
@@ -23,11 +23,13 @@ from mailman.app.lifecycle import create_list
 from mailman.config import config
 from mailman.database.transaction import transaction
 from mailman.interfaces.address import InvalidEmailAddressError
+from mailman.interfaces.bans import IBanManager
 from mailman.interfaces.listmanager import IListManager
 from mailman.interfaces.mailinglist import (
 IAcceptableAliasSet, IHeaderMatchList, IListArchiverSet)
 from mailman.interfaces.member import (
-AlreadySubscribedError, MemberRole, MissingPreferredAddressError)
+AlreadySubscribedError, MemberRole, MembershipIsBannedError,
+MissingPreferredAddressError)
 from mailman.interfaces.usermanager import IUserManager
 from mailman.testing.helpers import (
 configuration, get_queue_messages, set_preferred)
@@ -97,6 +99,13 @@ class TestMailingList(unittest.TestCase):
 self.assertRaises(InvalidEmailAddressError, self._mlist.subscribe,
   self._mlist.posting_address)
 
+def test_cannot_subscribe_banned_address(self):
+manager = getUtility(IUserManager)
+user = manager.create_user('a...@example.com', 'Anne Person')
+set_preferred(user)
+IBanManager(self._mlist).ban('a...@example.com')
+self.assertRaises(MembershipIsBannedError, self._mlist.subscribe, user)
+
 def test_is_subscribed(self):
 manager = getUtility(IUserManager)
 user = manager.create_user('a...@example.com', 'Anne Person')


=
src/mailman/utilities/tests/test_import.py
=
@@ -321,8 +321,8 @@ class TestBasicImport(unittest.TestCase):
 
 def test_ban_list(self):
 banned = [
-('a...@example.com', 'a...@example.com'),
-('^.*@example.com', 'b...@example.com'),
+('a...@example.net', 'a...@example.net'),
+('^.*@example.edu', 'b...@example.edu'),
 ('non-ascii-\x...@example.com', 'non-ascii-\uf..

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Properly capitalize new Subject: header.

2019-08-21 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
05d60864 by Mark Sapiro at 2019-08-21T18:32:43Z
Properly capitalize new Subject: header.

- - - - -
e8ef9a8a by Mark Sapiro at 2019-08-21T18:32:43Z
Merge branch 'nntp' into 'master'

Properly capitalize new Subject: header.

See merge request mailman/mailman!550
- - - - -


1 changed file:

- src/mailman/runners/nntp.py


Changes:

=
src/mailman/runners/nntp.py
=
@@ -127,7 +127,7 @@ def prepare_message(mlist, msg, msgdata):
msgdata.get('original_subject'))
 if not mlist.nntp_prefix_subject_too and stripped_subject is not None:
 del msg['subject']
-msg['subject'] = stripped_subject
+msg['Subject'] = stripped_subject
 # Add the appropriate Newsgroups header.  Multiple Newsgroups headers are
 # generally not allowed so we're not testing for them.
 header = msg.get('newsgroups')



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/e99fdce9a4ac1c3e1287500e9c1efbde47a58402...e8ef9a8a63af7cb30dce15bdcaf5be14d1ad3d43

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/e99fdce9a4ac1c3e1287500e9c1efbde47a58402...e8ef9a8a63af7cb30dce15bdcaf5be14d1ad3d43
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: Do not report non-VERP temp failure DSNs as unrecognized.

2019-08-15 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
3f61fd77 by Mark Sapiro at 2019-08-15T21:45:01Z
Do not report non-VERP temp failure DSNs as unrecognized.

- - - - -
e99fdce9 by Mark Sapiro at 2019-08-15T21:45:01Z
Merge branch 'bounce' into 'master'

Do not report non-VERP temp failure DSNs as unrecognized.

Closes #622

See merge request mailman/mailman!549
- - - - -


3 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/runners/bounce.py
- src/mailman/runners/tests/test_bounce.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -37,6 +37,8 @@ Bugs
   (Closes #614)
 * Encoded (base64 or quoted-printable) HTML message bodies are now decoded for
   ``html_to_plaintext``.  (Closes #616)
+* Non-VERPed temporary failure DSNs are no longer reported as unrecognized
+  bounces.  (Closes #622)
 
 Command line
 


=
src/mailman/runners/bounce.py
=
@@ -19,7 +19,7 @@
 
 import logging
 
-from flufl.bounce import all_failures, scan_message
+from flufl.bounce import all_failures
 from mailman.app.bounces import ProbeVERP, StandardVERP, maybe_forward
 from mailman.core.runner import Runner
 from mailman.interfaces.bounce import BounceContext, IBounceProcessor
@@ -64,11 +64,14 @@ class BounceRunner(Runner):
 context = BounceContext.probe
 else:
 # That didn't give us anything useful, so try the old fashion
-# bounce matching modules.  This returns only the permanently
-# failing addresses.  Since Mailman currently doesn't score
-# temporary failures, if we get no permanent failures, we're
-# done.s
-addresses = scan_message(msg)
+# bounce matching modules.  Since Mailman currently doesn't
+# score temporary failures, if we get no permanent failures,
+# we're done, but we do need to check for temporary failures
+# to know if the bounce was recognized.
+temporary, addresses = all_failures(msg)
+if len(addresses) == 0 and len(temporary) > 0:
+# This is a recognized temp fail so ignore it.
+return False
 # If that still didn't return us any useful addresses, then send it on
 # or discard it.  The addresses will come back from flufl.bounce as
 # bytes/8-bit strings, but we must store them as unicodes in the


=
src/mailman/runners/tests/test_bounce.py
=
@@ -169,7 +169,10 @@ Original-Recipient: rfc822; b...@example.com
 def test_nonverp_detectable_nonfatal_bounce(self):
 # Here's a bounce that is not VERPd, but which has a bouncing address
 # that can be parsed from a known bounce format.  The bounce is
-# non-fatal so no bounce event is registered.
+# non-fatal so no bounce event is registered and the bounce is not
+# reported as unrecognized.
+self._mlist.forward_unrecognized_bounces_to = (
+UnrecognizedBounceDisposition.site_owner)
 dsn = message_from_string("""\
 From: mail-dae...@example.com
 To: test-boun...@example.com
@@ -186,10 +189,15 @@ Original-Recipient: rfc822; b...@example.com
 --AAA--
 """)
 self._bounceq.enqueue(dsn, self._msgdata)
+mark = LogFileMark('mailman.bounce')
 self._runner.run()
 get_queue_messages('bounces', expected_count=0)
 events = list(self._processor.events)
 self.assertEqual(len(events), 0)
+# There should be nothing in the 'virgin' queue.
+get_queue_messages('virgin', expected_count=0)
+# There should be nothing logged.
+self.assertEqual(len(mark.readline()), 0)
 
 def test_no_detectable_bounce_addresses(self):
 # A bounce message was received, but no addresses could be detected.



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/9e12b0f79b46c175065d6ba6d20399a48d654ec1...e99fdce9a4ac1c3e1287500e9c1efbde47a58402

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/9e12b0f79b46c175065d6ba6d20399a48d654ec1...e99fdce9a4ac1c3e1287500e9c1efbde47a58402
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: Fixed nntp runner to use BytesIO rather than StringIO.

2019-06-27 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
e4d9e520 by Mark Sapiro at 2019-06-27T15:52:58Z
Fixed nntp runner to use BytesIO rather than StringIO.

- - - - -
7b914322 by Mark Sapiro at 2019-06-27T15:52:58Z
Merge branch 'fix_613' into 'master'

Fixed nntp runner to use BytesIO rather than StringIO.

Closes #613

See merge request mailman/mailman!532
- - - - -


4 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/runners/nntp.py
- src/mailman/runners/tests/test_nntp.py
- src/mailman/testing/helpers.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -31,6 +31,8 @@ Bugs
   already pending are now handled properly.  (Closes #577 and #583)
 * It is no longer possible to add the list's posting address with any role to
   a list.  (Closes #599)
+* Fixed the nntp runner which was calling the ``nntplib.NNTP.post()`` method
+  with a string object instead of bytes.  (Closes #613)
 
 Command line
 


=
src/mailman/runners/nntp.py
=
@@ -23,7 +23,7 @@ import socket
 import logging
 import nntplib
 
-from io import StringIO
+from io import BytesIO
 from mailman.config import config
 from mailman.core.runner import Runner
 from mailman.interfaces.nntp import NewsgroupModeration
@@ -66,8 +66,8 @@ class NNTPRunner(Runner):
 # Make sure we have the most up-to-date state
 if not msgdata.get('prepped'):
 prepare_message(mlist, msg, msgdata)
-# Flatten the message object, sticking it in a StringIO object
-fp = StringIO(msg.as_string())
+# Flatten the message object, sticking it in a BytesIO object
+fp = BytesIO(msg.as_bytes())
 conn = None
 try:
 conn = nntplib.NNTP(host, port,


=
src/mailman/runners/tests/test_nntp.py
=
@@ -21,6 +21,7 @@ import socket
 import nntplib
 import unittest
 
+from email import message_from_bytes
 from mailman.app.lifecycle import create_list
 from mailman.config import config
 from mailman.interfaces.nntp import NewsgroupModeration
@@ -274,7 +275,7 @@ Testing
 self.assertEqual(len(args[0]), 1)
 # No keyword arguments.
 self.assertEqual(len(args[1]), 0)
-msg = mfs(args[0][0].read())
+msg = message_from_bytes(args[0][0].read())
 self.assertEqual(msg['subject'], 'A newsgroup posting')
 
 @mock.patch('nntplib.NNTP')


=
src/mailman/testing/helpers.py
=
@@ -30,7 +30,7 @@ import datetime
 import threading
 
 from contextlib import contextmanager, suppress
-from email import message_from_string
+from email import message_from_bytes, message_from_string
 from lazr.config import as_timedelta
 from mailman.bin.master import Loop as Master
 from mailman.config import config
@@ -250,7 +250,7 @@ def get_nntp_server(cleanups):
 class NNTPProxy:  # noqa: E306
 def get_message(self):
 args = nntpd.post.call_args
-return specialized_message_from_string(args[0][0].read())
+return message_from_bytes(args[0][0].read())
 return NNTPProxy()
 
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/441634d92e46bd610abe61e4a9ac3c089e8305ab...7b9143229c3b8417556fcf96dd7ae23b8b316747

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/441634d92e46bd610abe61e4a9ac3c089e8305ab...7b9143229c3b8417556fcf96dd7ae23b8b316747
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: Add an Auto-Submitted: header to (un)subscribe confirmation requests.

2019-06-23 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
8f1a7d58 by Mark Sapiro at 2019-06-23T23:58:01Z
Add an Auto-Submitted: header to (un)subscribe confirmation requests.

- - - - -
441634d9 by Mark Sapiro at 2019-06-23T23:58:01Z
Merge branch 'fix_23' into 'master'

Add an Auto-Submitted: header to (un)subscribe confirmation requests.

Closes #23

See merge request mailman/mailman!530
- - - - -


4 changed files:

- src/mailman/app/subscriptions.py
- src/mailman/app/tests/test_subscriptions.py
- src/mailman/app/tests/test_unsubscriptions.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/app/subscriptions.py
=
@@ -579,6 +579,8 @@ def _handle_confirmation_needed_events(event, 
template_name):
 msg = UserNotification(
 email_address, confirm_address, subject, text,
 event.mlist.preferred_language)
+del msg['auto-submitted']
+msg['Auto-Submitted'] = 'auto-generated'
 msg.send(event.mlist, add_precedence=False)
 
 


=
src/mailman/app/tests/test_subscriptions.py
=
@@ -508,6 +508,8 @@ approval:
 message['From'], 'test-confirm+{}@example.com'.format(token))
 # The confirmation message is not `Precedence: bulk`.
 self.assertIsNone(message['precedence'])
+# The confirmation message is `Auto-Submitted: auto-generated`.
+self.assertEqual(message['auto-submitted'], 'auto-generated')
 # The state machine stopped at the moderator approval so there will be
 # one token still in the database.
 self._expected_pendings_count = 1


=
src/mailman/app/tests/test_unsubscriptions.py
=
@@ -329,6 +329,10 @@ request approval:
 message['Subject'], 'confirm {}'.format(workflow.token))
 self.assertEqual(
 message['From'], 'test-confirm+{}@example.com'.format(token))
+# The confirmation message is not `Precedence: bulk`.
+self.assertIsNone(message['precedence'])
+# The confirmation message is `Auto-Submitted: auto-generated`.
+self.assertEqual(message['auto-submitted'], 'auto-generated')
 # The state machine stopped at the member confirmation step so there
 # will be one token still in the database.
 self._expected_pendings_count = 1


=
src/mailman/docs/NEWS.rst
=
@@ -72,6 +72,8 @@ Other
 * Add support for SMPTS/STARTTLS for connections to MTA. (See !508)
 * The last remnants of the mailing list attribute ``nntp_host`` have been
   removed.  (Closes #611)
+* Email confirmation requests now include an ``Auto-Submitted`` header to
+  prevent robotic replies per ``RFC 3834``.  (Closes #23)
 
 3.2.2
 =



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/f3b2e4a536e0fe01db5e586af018232677e40e64...441634d92e46bd610abe61e4a9ac3c089e8305ab

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/f3b2e4a536e0fe01db5e586af018232677e40e64...441634d92e46bd610abe61e4a9ac3c089e8305ab
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: Removed the last remnants of the mailing list attribute nntp_host.

2019-06-22 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
59d8b47c by Mark Sapiro at 2019-06-23T01:52:23Z
Removed the last remnants of the mailing list attribute nntp_host.

- - - - -
f3b2e4a5 by Mark Sapiro at 2019-06-23T01:52:23Z
Merge branch 'fix_611' into 'master'

Removed the last remnants of the mailing list attribute nntp_host.

Closes #611

See merge request mailman/mailman!529
- - - - -


5 changed files:

- src/mailman/core/tests/test_pipelines.py
- src/mailman/docs/NEWS.rst
- src/mailman/handlers/docs/nntp.rst
- src/mailman/handlers/to_usenet.py
- src/mailman/styles/base.py


Changes:

=
src/mailman/core/tests/test_pipelines.py
=
@@ -180,7 +180,6 @@ testing
 # Set up NNTP.
 self._mlist.gateway_to_news = True
 self._mlist.linked_newsgroup = 'testing'
-self._mlist.nntp_host = 'news.example.com'
 # Process the email.
 process(self._mlist, self._msg, {},
 pipeline_name='default-posting-pipeline')


=
src/mailman/docs/NEWS.rst
=
@@ -70,6 +70,8 @@ Other
 * REST Runner now uses Gunicorn to run WSGI server instead of the standard
   library wsgiref for better performance.
 * Add support for SMPTS/STARTTLS for connections to MTA. (See !508)
+* The last remnants of the mailing list attribute ``nntp_host`` have been
+  removed.  (Closes #611)
 
 3.2.2
 =


=
src/mailman/handlers/docs/nntp.rst
=
@@ -44,12 +44,11 @@ Neither are digests ever gated to the newsgroup.
 []
 
 However, other posted messages get gated to the newsgroup via the nntp queue.
-The list owner can set the linked newsgroup and the nntp host that its
-messages are gated to.
+The list owner can set the linked newsgroup.  The nntp host that messages are
+gated to is a global configuration.
 ::
 
 >>> mlist.linked_newsgroup = 'comp.lang.thing'
->>> mlist.nntp_host = 'news.example.com'
 >>> handler.process(mlist, msg, {})
 >>> messages = get_queue_messages('nntp')
 >>> len(messages)


=
src/mailman/handlers/to_usenet.py
=
@@ -50,8 +50,6 @@ class ToUsenet:
 error = []
 if not mlist.linked_newsgroup:
 error.append('no newsgroup')
-if not mlist.nntp_host:
-error.append('no NNTP host')
 if error:
 log.error('NNTP gateway improperly configured: %s',
   COMMASPACE.join(error))


=
src/mailman/styles/base.py
=
@@ -92,7 +92,6 @@ class BasicOperation:
 mlist.dmarc_moderation_notice = ''
 mlist.dmarc_wrapped_message_text = ''
 # NNTP gateway
-mlist.nntp_host = ''
 mlist.linked_newsgroup = ''
 mlist.gateway_to_news = False
 mlist.gateway_to_mail = False



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/8f88a7c05b0424977820593c06cdeeb7aa238ce7...f3b2e4a536e0fe01db5e586af018232677e40e64

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/8f88a7c05b0424977820593c06cdeeb7aa238ce7...f3b2e4a536e0fe01db5e586af018232677e40e64
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: Don't notify existing admins of each imported member.

2019-06-07 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
30b4a04c by Mark Sapiro at 2019-06-07T21:56:53Z
Don't notify existing admins of each imported member.

- - - - -
58c36bda by Mark Sapiro at 2019-06-07T21:56:53Z
Merge branch 'fix_605' into 'master'

Don't notify existing admins of each imported member.

Closes #605

See merge request mailman/mailman!523
- - - - -


2 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/utilities/importer.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -42,6 +42,8 @@ Command line
   actions for nonmembers following a member in the list.  (closes #580)
 * The progress meter while ``mailman import21`` is importing rosters has been
   shortened so it no longer wraps and scrolls.  (Closes #589)
+* The ``mailman import21`` command no longer sends an email to existing owners
+  for each imported member.  (Closes #605)
 
 REST
 


=
src/mailman/utilities/importer.py
=
@@ -506,9 +506,11 @@ def import_config_pck(mlist, config_dict):
 regulars_set = set(config_dict.get('members', {}))
 digesters_set = set(config_dict.get('digest_members', {}))
 members = regulars_set.union(digesters_set)
-# Don't send welcome messages when we import the rosters.
+# Don't send welcome messages or notify admins when we import the rosters.
 send_welcome_message = mlist.send_welcome_message
 mlist.send_welcome_message = False
+admin_notify_mchanges = mlist.admin_notify_mchanges
+mlist.admin_notify_mchanges = False
 try:
 import_roster(mlist, config_dict, members, MemberRole.member)
 import_roster(mlist, config_dict, config_dict.get('owner', []),
@@ -533,6 +535,7 @@ def import_config_pck(mlist, config_dict):
 list_prop.remove(email)
 finally:
 mlist.send_welcome_message = send_welcome_message
+mlist.admin_notify_mchanges = admin_notify_mchanges
 
 
 def import_roster(mlist, config_dict, members, role, action=None):



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/b565568ed67b651e0b9a8bd5fe3bae613ae23e64...58c36bda01bcd0aa2720877e94cf513dae31a0d3

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/b565568ed67b651e0b9a8bd5fe3bae613ae23e64...58c36bda01bcd0aa2720877e94cf513dae31a0d3
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: Catch various exceptions in email join command.

2019-05-15 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
5ca0e415 by Mark Sapiro at 2019-05-15T23:47:39Z
Catch various exceptions in email join command.

- - - - -
3c4e6ad9 by Mark Sapiro at 2019-05-15T23:47:39Z
Merge branch 'eml_err' into 'master'

Catch various exceptions in email join command.

Closes #583 and #577

See merge request mailman/mailman!516
- - - - -


3 changed files:

- src/mailman/commands/eml_membership.py
- src/mailman/commands/tests/test_eml_membership.py
- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/commands/eml_membership.py
=
@@ -20,9 +20,10 @@
 from email.utils import formataddr, parseaddr
 from mailman.core.i18n import _
 from mailman.interfaces.command import ContinueProcessing, IEmailCommand
-from mailman.interfaces.member import DeliveryMode, MemberRole
+from mailman.interfaces.member import (
+AlreadySubscribedError, DeliveryMode, MembershipIsBannedError)
 from mailman.interfaces.subscriptions import (
-ISubscriptionManager, ISubscriptionService)
+ISubscriptionManager, SubscriptionPendingError)
 from mailman.interfaces.usermanager import IUserManager
 from public import public
 from zope.component import getUtility
@@ -93,16 +94,18 @@ used.
 joins.add(email)
 results.joins = joins
 person = formataddr((display_name, email))# noqa: F841
-# Is this person already a member of the list?  Search for all
-# matching memberships.
-members = getUtility(ISubscriptionService).find_members(
-email, mlist.list_id, MemberRole.member)
-if len(members) > 0:
-print(_('$person is already a member'), file=results)
-return ContinueProcessing.yes
 subscriber = match_subscriber(email, display_name)
-ISubscriptionManager(mlist).register(subscriber)
-print(_('Confirmation email sent to $person'), file=results)
+try:
+ISubscriptionManager(mlist).register(subscriber)
+except (AlreadySubscribedError, MembershipIsBannedError) as e:
+print(str(e), file=results)
+except SubscriptionPendingError:
+# SubscriptionPendingError doesn't return an error message.
+listname = mlist.fqdn_listname# noqa: F841
+print(_('$person has a pending subscription for $listname'),
+  file=results)
+else:
+print(_('Confirmation email sent to $person'), file=results)
 return ContinueProcessing.yes
 
 def _parse_arguments(self, arguments, results):


=
src/mailman/commands/tests/test_eml_membership.py
=
@@ -15,14 +15,16 @@
 # You should have received a copy of the GNU General Public License along with
 # GNU Mailman.  If not, see .
 
-"""Test the Leave command."""
+"""Test the Join and Leave commands."""
 
 import unittest
 
 from mailman.app.lifecycle import create_list
-from mailman.commands.eml_membership import Leave
+from mailman.commands.eml_membership import Join, Leave
 from mailman.email.message import Message
+from mailman.interfaces.bans import IBanManager
 from mailman.interfaces.mailinglist import SubscriptionPolicy
+from mailman.interfaces.subscriptions import ISubscriptionManager
 from mailman.interfaces.usermanager import IUserManager
 from mailman.runners.command import Results
 from mailman.testing.helpers import set_preferred
@@ -52,3 +54,64 @@ class TestLeave(unittest.TestCase):
 self.assertEqual(
 str(results).splitlines()[-1],
 'leave: a...@example.com is not a member of a...@example.com')
+
+
+class TestJoin(unittest.TestCase):
+layer = ConfigLayer
+
+def setUp(self):
+self._mlist = create_list('a...@example.com')
+self._command = Join()
+
+def test_join_already_a_member(self):
+# Try to subscribe someone who is already a member.  Anne is a real
+# user, with a validated address, but she is not a member of the
+# mailing list yet.
+anne = getUtility(IUserManager).create_user('a...@example.com')
+set_preferred(anne)
+# First subscribe anne.
+ISubscriptionManager(self._mlist).register(anne, pre_verified=True,
+   pre_confirmed=True,
+   pre_approved=True)
+# Then initiate a subscription.
+msg = Message()
+msg['From'] = 'a...@example.com'
+results = Results()
+self._command.process(self._mlist, msg, {}, (), results)
+self.assertEqual(
+str(results).splitlines()[-1],
+'a...@example.com is already a MemberRole.member of '
+'mailing list a...@example.com')
+
+def test_join_banned(self):
+# Try to subscribe someone 

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Correct import of *_these_nonmembers action for nonmembers following a member.

2019-05-08 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
3a134d55 by Mark Sapiro at 2019-05-08T13:57:43Z
Correct import of *_these_nonmembers action for nonmembers following a member.

- - - - -
a873fc56 by Mark Sapiro at 2019-05-08T13:57:43Z
Merge branch 'import' into 'master'

Correct import of *_these_nonmembers action for nonmembers following a member.

Closes #580

See merge request mailman/mailman!510
- - - - -


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
=
@@ -31,6 +31,8 @@ Command line
   ``*_these_nonmembers`` list attributes.  (Closes #588)
 * The ``mailman import21`` command now imports nonmember accept actions as
   ``Action.defer`` rather than ``Action.accept``.  (Closes #579)
+* The ``mailman import21`` command now correctly imports ``*_these_nonmembers``
+  actions for nonmembers following a member in the list.  (closes #580)
 
 REST
 


=
src/mailman/utilities/importer.py
=
@@ -569,6 +569,7 @@ def _import_roster(mlist, config_dict, members, role, 
action=None):
 validator = getUtility(IEmailValidator)
 roster = mlist.get_roster(role)
 skipped = []
+action_arg = action
 for email in members:
 # For owners and members, the emails can have a mixed case, so
 # lowercase them all.
@@ -651,6 +652,10 @@ def _import_roster(mlist, config_dict, members, role, 
action=None):
 # Either this was set right above or in the function's arguments
 # for nonmembers.
 member.moderation_action = action
+# We need to restore the action argument in case we changed it
+# above so the changed action is not applied to the remaining
+# members.
+action = action_arg
 # Other preferences.
 if prefs is not None:
 # AcknowledgePosts


=
src/mailman/utilities/tests/test_import.py
=
@@ -1161,6 +1161,19 @@ class TestRosterImport(unittest.TestCase):
 self.assertEqual(len(list_prop), 1)
 self.assertTrue(all(addr.startswith('^') for addr in list_prop))
 
+def test_nonmember_following_member(self):
+self._pckdict['hold_these_nonmembers'] = [
+'li...@example.com',
+'ho...@example.com',
+]
+self._pckdict['members']['li...@example.com'] = 0
+self._pckdict['user_options'] = {'li...@example.com': 1}
+import_config_pck(self._mlist, self._pckdict)
+member = self._mlist.nonmembers.get_member('li...@example.com')
+self.assertEqual(member.moderation_action, Action.defer)
+member = self._mlist.nonmembers.get_member('ho...@example.com')
+self.assertEqual(member.moderation_action, Action.hold)
+
 
 class TestPreferencesImport(unittest.TestCase):
 """Preferences get imported too."""



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/34a2e87b7a441af70e9147ecf02d2cd1dc25147b...a873fc5647977ad573e073a4a5d70dc6d08f3bba

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/34a2e87b7a441af70e9147ecf02d2cd1dc25147b...a873fc5647977ad573e073a4a5d70dc6d08f3bba
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: Make *_these_nonmembers SQLAlchemy MutableList type.

2019-05-06 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
329b3728 by Mark Sapiro at 2019-05-06T20:23:45Z
Make *_these_nonmembers SQLAlchemy MutableList type.

- - - - -
3b18f704 by Mark Sapiro at 2019-05-06T20:23:45Z
Merge branch 'import_nonmember' into 'master'

Make *_these_nonmembers SQLAlchemy MutableList type.

Closes #588

See merge request mailman/mailman!505
- - - - -


2 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/model/mailinglist.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -22,6 +22,11 @@ Bugs
   ``CC`` will now be removed from ``CC`` even if this results in no ``CC``.
   (Closes #575)
 
+Command line
+
+* The ``mailman import21`` command now leaves only regexps in the legacy
+  ``*_these_nonmembers`` list attributes.  (Closes #588)
+
 REST
 
 * Expose a user's preferred address using REST API. (Closes #240)


=
src/mailman/model/mailinglist.py
=
@@ -54,6 +54,7 @@ from sqlalchemy import (
 LargeBinary, PickleType)
 from sqlalchemy.event import listen
 from sqlalchemy.ext.hybrid import hybrid_property
+from sqlalchemy.ext.mutable import MutableList
 from sqlalchemy.orm import relationship
 from sqlalchemy.orm.exc import NoResultFound
 from zope.component import getUtility
@@ -98,7 +99,7 @@ class MailingList(Model):
 # Attributes which are directly modifiable via the web u/i.  The more
 # complicated attributes are currently stored as pickles, though that
 # will change as the schema and implementation is developed.
-accept_these_nonmembers = Column(PickleType)   # XXX
+accept_these_nonmembers = Column(MutableList.as_mutable(PickleType))  # XXX
 admin_immed_notify = Column(Boolean)
 admin_notify_mchanges = Column(Boolean)
 administrivia = Column(Boolean)
@@ -141,14 +142,14 @@ class MailingList(Model):
 digest_send_periodic = Column(Boolean)
 digest_size_threshold = Column(Float)
 digest_volume_frequency = Column(Enum(DigestFrequency))
-discard_these_nonmembers = Column(PickleType)
+discard_these_nonmembers = Column(MutableList.as_mutable(PickleType))
 emergency = Column(Boolean)
 encode_ascii_prefixes = Column(Boolean)
 first_strip_reply_to = Column(Boolean)
 forward_auto_discards = Column(Boolean)
 gateway_to_mail = Column(Boolean)
 gateway_to_news = Column(Boolean)
-hold_these_nonmembers = Column(PickleType)
+hold_these_nonmembers = Column(MutableList.as_mutable(PickleType))
 info = Column(SAUnicode)
 linked_newsgroup = Column(SAUnicode)
 max_days_to_hold = Column(Integer)
@@ -169,7 +170,7 @@ class MailingList(Model):
 posting_pipeline = Column(SAUnicode)
 _preferred_language = Column('preferred_language', SAUnicode)
 display_name = Column(SAUnicode)
-reject_these_nonmembers = Column(PickleType)
+reject_these_nonmembers = Column(MutableList.as_mutable(PickleType))
 reply_goes_to_list = Column(Enum(ReplyToMunging))
 reply_to_address = Column(SAUnicode)
 require_explicit_destination = Column(Boolean)



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/06eae890432fb53d44ca81979f5e43071d1c4c0e...3b18f7046edf0ef5b58f74301c0c1ef8600a0e99

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/06eae890432fb53d44ca81979f5e43071d1c4c0e...3b18f7046edf0ef5b58f74301c0c1ef8600a0e99
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: Add alembic migration for tag column added to headermatch table.

2019-04-28 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
5deec34f by Mark Sapiro at 2019-04-28T17:36:28Z
Add alembic migration for tag column added to headermatch table.

Fixes #585

- - - - -
9da59491 by Mark Sapiro at 2019-04-28T18:30:45Z
Merge branch 'fix_585' into 'master'

Add alembic migration for tag column added to headermatch table.

Closes #585

See merge request mailman/mailman!501
- - - - -


1 changed file:

- + src/mailman/database/alembic/versions/2d2d0ef0828f_add_tag_column.py


Changes:

=
src/mailman/database/alembic/versions/2d2d0ef0828f_add_tag_column.py
=
@@ -0,0 +1,32 @@
+"""add tag column
+
+Revision ID: 2d2d0ef0828f
+Revises: 15401063d4e3
+Create Date: 2019-04-27 08:58:48.496854
+
+"""
+
+import sqlalchemy as sa
+
+from alembic import op
+from mailman.database.helpers import exists_in_db, is_sqlite
+from mailman.database.types import SAUnicode
+
+
+# revision identifiers, used by Alembic.
+revision = '2d2d0ef0828f'
+down_revision = '15401063d4e3'
+
+
+def upgrade():
+if not exists_in_db(op.get_bind(), 'headermatch', 'tag'):
+# SQLite may not have removed it when downgrading.
+op.add_column(
+'headermatch',
+sa.Column('tag', type_=SAUnicode, nullable=True))
+
+
+def downgrade():
+if not is_sqlite(op.get_bind()):
+# diffcov runs with SQLite so this isn't covered.
+op.drop_column('headermatch', 'tag')# pragma: nocover



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/b59182101846acf8227fbb3556d7c11e7acbf7e4...9da594913d24107323a3194ed86262b11f41f4ca

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/b59182101846acf8227fbb3556d7c11e7acbf7e4...9da594913d24107323a3194ed86262b11f41f4ca
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] 3 commits: qmail-lmtp: document new hostname parameter

2019-04-09 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
1d9ab69d by Michael Lutonsky at 2019-04-09T17:08:45Z
qmail-lmtp: document new hostname parameter
- - - - -
d4b09520 by Michael Lutonsky at 2019-04-09T17:52:48Z
qmail-lmtp: reword new hostname parameter docs
- - - - -
74e33c3a by Mark Sapiro at 2019-04-09T18:02:42Z
Merge branch 'patch-1' into 'master'

qmail-lmtp: document new hostname parameter

See merge request mailman/mailman!496
- - - - -


1 changed file:

- src/mailman/docs/mta.rst


Changes:

=
src/mailman/docs/mta.rst
=
@@ -414,7 +414,9 @@ the user ``mailman``, qmail will give you the destination 
address
 ``mailman-s...@lists.example.com`` while it should actually be
 ``s...@lists.example.com``.  The second argument to ``qmail-lmtp`` defines
 how many parts (separated by dashes) to filter out.  The first argument
-specifies the LMTP port of Mailman.  Long story short, as user mailman:
+specifies the LMTP port of Mailman.  An optional third argument specifies the
+LMTP hostname to connect to (by default localhost).
+Long story short, as user mailman:
 ::
 
 % chmod +t "$HOME"



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/329a1b75b315709a6ea88f3e7b81a581981c5053...74e33c3a3181134cb0cce9e6c9a9039bc5840fca

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/329a1b75b315709a6ea88f3e7b81a581981c5053...74e33c3a3181134cb0cce9e6c9a9039bc5840fca
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: Fix qmail-lmtp port argument

2019-04-09 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
127f6f57 by Richard Kroegel at 2019-04-09T16:34:46Z
Fix qmail-lmtp port argument
- - - - -
329a1b75 by Mark Sapiro at 2019-04-09T16:54:21Z
Merge branch 'patch-1' into 'master'

Fix qmail-lmtp port argument

See merge request mailman/mailman!495
- - - - -


1 changed file:

- contrib/qmail-lmtp


Changes:

=
contrib/qmail-lmtp
=
@@ -11,7 +11,7 @@ try:
 import os
 
 lmtp_host = sys.argv[3] if len(sys.argv) > 3 else 'localhost'
-lmtp = smtplib.LMTP(lmtp_host, int(sys.argv[2]))
+lmtp = smtplib.LMTP(lmtp_host, int(sys.argv[1]))
 
 try:
 # See  for qmail 
command



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/141b70ba7a814d8d35f9df0528f715240f6e9ae3...329a1b75b315709a6ea88f3e7b81a581981c5053

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/141b70ba7a814d8d35f9df0528f715240f6e9ae3...329a1b75b315709a6ea88f3e7b81a581981c5053
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: qmail-lmtp: support running mailman on a different host

2019-04-09 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
dcacc0bb by Michael Lutonsky at 2019-03-26T15:41:20Z
qmail-lmtp: support running mailman on a different host
- - - - -
141b70ba by Mark Sapiro at 2019-04-09T16:29:40Z
Merge branch 'patch-1' into 'master'

qmail-lmtp: support running mailman on a different host

Closes #571

See merge request mailman/mailman!485
- - - - -


1 changed file:

- contrib/qmail-lmtp


Changes:

=
contrib/qmail-lmtp
=
@@ -10,7 +10,8 @@ try:
 import sys
 import os
 
-lmtp = smtplib.LMTP("localhost", int(sys.argv[1]))
+lmtp_host = sys.argv[3] if len(sys.argv) > 3 else 'localhost'
+lmtp = smtplib.LMTP(lmtp_host, int(sys.argv[2]))
 
 try:
 # See  for qmail 
command



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/cade5cc26f4c410e649db761bed337fa2672fcfb...141b70ba7a814d8d35f9df0528f715240f6e9ae3

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/cade5cc26f4c410e649db761bed337fa2672fcfb...141b70ba7a814d8d35f9df0528f715240f6e9ae3
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: Work around click hang issue.

2019-03-20 Thread Mark Sapiro via Mailman-checkins


Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
88d54838 by Mark Sapiro at 2019-03-20T15:43:57Z
Work around click hang issue.

An issue in the interaction between click ctx.exit() and
contextlib.ExitStack has been worked around as suggested at
https://github.com/pallets/click/issues/1134#issuecomment-436308107

Fixes #520

- - - - -
3a1d9a3d by Mark Sapiro at 2019-03-21T00:49:45Z
Merge branch 'click_fix' into 'master'

Work around click hang issue.

Closes #520

See merge request mailman/mailman!477
- - - - -


3 changed files:

- src/mailman/bin/mailman.py
- src/mailman/docs/NEWS.rst
- src/mailman/rest/tests/test_validator.py


Changes:

=
src/mailman/bin/mailman.py
=
@@ -18,7 +18,6 @@
 """The 'mailman' command dispatcher."""
 import click
 
-from contextlib import ExitStack
 from mailman.commands.cli_help import help as help_command
 from mailman.config import config
 from mailman.core.i18n import _
@@ -60,13 +59,14 @@ class Subcommands(click.MultiCommand):
 # This is here to hook command parsing into the Mailman database
 # transaction system.  If the subcommand succeeds, the transaction is
 # committed, otherwise it's aborted.
+# See https://github.com/pallets/click/issues/1134
 def invoke(self, ctx):
-with ExitStack() as resources:
-# If given a bogus subcommand, the database won't have been
-# initialized so there's no transaction to commit.
-if config.db is not None:
-resources.enter_context(transaction())
-return super().invoke(ctx)
+# If given a bogus subcommand, the database won't have been
+# initialized so there's no transaction to commit.
+if config.db is not None:
+with transaction():
+return super().invoke(ctx)
+return super().invoke(ctx) # pragma: missed
 
 # https://github.com/pallets/click/issues/834
 #


=
src/mailman/docs/NEWS.rst
=
@@ -32,6 +32,9 @@ REST
 Command line
 
 * The ``mailman import21`` command now displays import progress.  (Closes #561)
+* An issue with ``mailman subcommand --help`` hanging has been worked around.
+  (Closes #520)
+
 
 3.2.1
 =


=
src/mailman/rest/tests/test_validator.py
=
@@ -134,3 +134,5 @@ class TestValidators(unittest.TestCase):
 ValueError, email_or_regexp_validator, 'foo.example.com')
 self.assertRaises(
 ValueError, email_or_regexp_validator, '^[^@]+(')
+self.assertRaises(
+ValueError, email_or_regexp_validator, '')



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/34b4f1498ad61fd62c287f4e4f4d6de62557c453...3a1d9a3d7c6b1fae8f9e27b8181ea3e1d7c863b2

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/34b4f1498ad61fd62c287f4e4f4d6de62557c453...3a1d9a3d7c6b1fae8f9e27b8181ea3e1d7c863b2
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: Adds user_name_or_address substitution variable

2019-01-16 Thread Mark Sapiro via Mailman-checkins
Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
4152dbfb by Nick Wynja at 2019-01-16T01:44:34Z
Adds user_name_or_address substitution variable

Closes #533

- - - - -
8d9f8055 by Mark Sapiro at 2019-01-16T16:00:52Z
Merge branch '533-user_name_or_address' into 'master'

Adds user_name_or_address substitution variable

Closes #533

See merge request mailman/mailman!434
- - - - -


4 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/handlers/decorate.py
- src/mailman/handlers/tests/test_decorate.py
- src/mailman/rest/docs/templates.rst


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -44,6 +44,9 @@ Other
 * An ``explicit_header_only`` option has been added to Reply-To: munging to
   avoid putting the list address in Cc:.  (Closes #531)
 * The default list welcome message has been cleaned up a bit.  (Closes #530)
+* A substitution variable ``user_name_or_email`` has been added to
+  ``list:member:regular:header`` and ``list:member:regular:footer`` templates
+  when personalized deliveries are enabled.  (Closes #533)
 
 
 3.2.0 -- "La Villa Strangiato"


=
src/mailman/handlers/decorate.py
=
@@ -65,6 +65,7 @@ def process(mlist, msg, msgdata):
 d['user_delivered_to'] = _address.original_email
 d['user_language'] = member.preferred_language.description
 d['user_name'] = member.display_name
+d['user_name_or_address'] = member.display_name or recipient
 # For backward compatibility.
 d['user_address'] = recipient
 # Calculate the archiver permalink substitution variables.  This provides


=
src/mailman/handlers/tests/test_decorate.py
=
@@ -169,6 +169,44 @@ This is a test message.
 self.assertIn('Anne Person ',
   self._msg.as_string())
 
+def test_decorate_user_name_or_address_as_user_name(self):
+site_dir = os.path.join(config.TEMPLATE_DIR, 'site', 'en')
+os.makedirs(site_dir)
+footer_path = os.path.join(site_dir, 'myfooter.txt')
+with open(footer_path, 'w', encoding='utf-8') as fp:
+print('$user_name_or_address', file=fp)
+getUtility(ITemplateManager).set(
+'list:member:regular:footer', None, 'mailman:///myfooter.txt')
+self._mlist.preferred_language = 'en'
+user = getUtility(IUserManager).make_user(
+'aper...@example.com', 'Anne Person')
+member = Member(MemberRole.member, self._mlist.list_id, user)
+member.preferences = Preferences()
+member.preferences.preferred_language = 'en'
+msgdata = dict(member=member)
+decorate.process(self._mlist, self._msg, msgdata)
+self.assertIn('Anne Person',
+  self._msg.as_string())
+
+def test_decorate_user_name_or_address_as_address(self):
+site_dir = os.path.join(config.TEMPLATE_DIR, 'site', 'en')
+os.makedirs(site_dir)
+footer_path = os.path.join(site_dir, 'myfooter.txt')
+with open(footer_path, 'w', encoding='utf-8') as fp:
+print('$user_name_or_address', file=fp)
+getUtility(ITemplateManager).set(
+'list:member:regular:footer', None, 'mailman:///myfooter.txt')
+self._mlist.preferred_language = 'en'
+user = getUtility(IUserManager).make_user(
+'aper...@example.com')
+member = Member(MemberRole.member, self._mlist.list_id, user)
+member.preferences = Preferences()
+member.preferences.preferred_language = 'en'
+msgdata = dict(member=member)
+decorate.process(self._mlist, self._msg, msgdata)
+self.assertIn('aper...@example.com',
+  self._msg.as_string())
+
 def test_decorate_header_footer_with_bad_character_mpa(self):
 site_dir = os.path.join(config.TEMPLATE_DIR, 'site', 'en')
 os.makedirs(site_dir)


=
src/mailman/rest/docs/templates.rst
=
@@ -466,6 +466,9 @@ below.  Here are all the supported template names:
 * ``user_language`` - the description of the user's preferred language
   (e.g. "French", "English", "Italian")
 * ``user_name`` - the recipient's display name if available
+* ``user_name_or_email`` - the recipient's display name if available,
+  or their email address if no display name
+  (e.g. "Anne Person", "Bart", or "fper...@example.com")
 
 * ``list:member:regular:header``
 The header for a regular (non-digest) message.
@@ -479,6 +482,9 @@ below.  Here are all the supported template names:
 * ``user_language`` - the description of the user's preferred language
   (e.g. "French", "English", "Italian")
 * ``user_name`` - the recipient's display name if available
+* ``user_name_or_email`` -

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Minor cleanup of the list welcome message template.

2019-01-12 Thread Mark Sapiro via Mailman-checkins
Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
229ad59e by Mark Sapiro at 2019-01-12T20:23:20Z
Minor cleanup of the list welcome message template.

- - - - -
dcc4e34a by Mark Sapiro at 2019-01-12T20:40:35Z
Merge branch 'template' into 'master'

Minor cleanup of the list welcome message template.

Closes #530

See merge request mailman/mailman!425
- - - - -


3 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/rest/docs/templates.rst
- src/mailman/templates/en/list:user:notice:welcome.txt


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -43,6 +43,7 @@ Other
   generate a Results email.  (Closes #516)
 * An ``explicit_header_only`` option has been added to Reply-To: munging to
   avoid putting the list address in Cc:.  (Closes #531)
+* The default list welcome message has been cleaned up a bit.  (Closes #530)
 
 
 3.2.0 -- "La Villa Strangiato"


=
src/mailman/rest/docs/templates.rst
=
@@ -46,15 +46,16 @@ subscribed to the mailing list, she sees this plain welcome 
message.
 
   a...@example.com
 
-You can make such adjustments via email by sending a message to:
+You can unsubscribe or make adjustments to your options via email by
+sending a message to:
 
   ant-requ...@example.com
 
 with the word 'help' in the subject or body (don't include the
 quotes), and you will get back a message with instructions.  You will
 need your password to change your options, but for security purposes,
-this email is not included here.  If you have forgotten your password you
-will need to click on the 'Forgot Password?' link on the login page.
+this password is not included here.  If you have forgotten your
+password you will need to reset it via the web UI.
 
 Let's say though that you wanted to provide a link to a Code of Conduct in the
 welcome message.  You publish both the code of conduct and the welcome message


=
src/mailman/templates/en/list:user:notice:welcome.txt
=
@@ -4,12 +4,13 @@ To post to this list, send your email to:
 
   $listname
 
-You can make such adjustments via email by sending a message to:
+You can unsubscribe or make adjustments to your options via email by sending
+a message to:
 
   $request_email
 
 with the word 'help' in the subject or body (don't include the quotes), and
 you will get back a message with instructions.  You will need your password to
-change your options, but for security purposes, this email is not included
-here.  If you have forgotten your password you will need to click on the
-'Forgot Password?' link on the login page.
+change your options, but for security purposes, this password is not included
+here.  If you have forgotten your password you will need to reset it via the
+web UI.



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/25e2228723e878ab1fba751db349ef363d213e65...dcc4e34a1f24e1b12da74e3ea64144b47ae217f7

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/25e2228723e878ab1fba751db349ef363d213e65...dcc4e34a1f24e1b12da74e3ea64144b47ae217f7
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: Outgoing delivery closes the smtp connection after each message.

2019-01-12 Thread Mark Sapiro via Mailman-checkins
Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
00ea75ea by Mark Sapiro at 2019-01-12T18:52:31Z
Outgoing delivery closes the smtp connection after each message.

- - - - -
25e22287 by Mark Sapiro at 2019-01-12T20:09:15Z
Merge branch 'smtp_quit' into 'master'

Outgoing delivery closes the smtp connection after each message.

Closes #529

See merge request mailman/mailman!432
- - - - -


4 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/mta/deliver.py
- src/mailman/mta/tests/test_connection.py
- src/mailman/mta/tests/test_delivery.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -29,6 +29,8 @@ Bugs
   (Closes #504)
 * Message parts are now properly decoded when trying to remove an Approved:
   header.  (Closes #518)
+* Outgoing SMTP connections are now closed following message delivery
+  regardless of the max_sessions_per_connection setting.  (Closes #529)
 
 REST
 


=
src/mailman/mta/deliver.py
=
@@ -84,6 +84,15 @@ def deliver(mlist, msg, msgdata):
 # for re-delivery later.
 t0 = time.time()
 refused = agent.deliver(mlist, msg, msgdata)
+# At this point we have completed the initial SMTP for this message.
+# We should close the SMTP connection regardless of the
+# sessions_per_connection setting because otherwise if there are no more
+# messages in the queue, the connection is left open until it times out
+# which can cause problems in the MTA.
+# XXX It would arguably be better to close only if the queue is empty, but
+# this means examining the queue here or closing from the outgoing runner,
+# either of which requires more information than should be available.
+agent._connection.quit()
 t1 = time.time()
 # Log this posting.
 size = getattr(msg, 'original_size', msgdata.get('original_size'))


=
src/mailman/mta/tests/test_connection.py
=
@@ -90,6 +90,14 @@ Subject: aardvarks
 self.connection.quit()
 self.assertEqual(SMTPLayer.smtpd.get_connection_count(), 2)
 
+def test_count_2_no_quit(self):
+self.connection.sendmail(
+'a...@example.com', ['b...@example.com'], self.msg_text)
+self.connection.sendmail(
+'c...@example.com', ['d...@example.com'], self.msg_text)
+self.connection.quit()
+self.assertEqual(SMTPLayer.smtpd.get_connection_count(), 1)
+
 def test_count_reset(self):
 self.connection.sendmail(
 'a...@example.com', ['b...@example.com'], self.msg_text)


=
src/mailman/mta/tests/test_delivery.py
=
@@ -30,7 +30,8 @@ from mailman.mta.bulk import BulkDelivery
 from mailman.mta.deliver import Deliver
 from mailman.testing.helpers import (
 specialized_message_from_string as mfs, subscribe)
-from mailman.testing.layers import ConfigLayer
+from mailman.testing.layers import ConfigLayer, SMTPLayer
+from mailman.utilities.modules import find_name
 from zope.component import getUtility
 
 
@@ -200,3 +201,61 @@ list: Test
 Footer
 
 """)
+
+
+class TestCloseAfterDelivery(unittest.TestCase):
+"""Test that connections close after delivery."""
+
+layer = SMTPLayer
+
+def setUp(self):
+self._mlist = create_list('t...@example.com')
+# Set personalized delivery.
+self._mlist.personalize = Personalization.individual
+# Make Anne a member of this mailing list.
+self._anne = subscribe(self._mlist, 'Anne', email='a...@example.org')
+self._msg = mfs("""\
+From: a...@example.org
+To: t...@example.com
+Subject: test
+
+""")
+self._deliverer = find_name(config.mta.outgoing)
+# Set the maximum transactions per connection.
+config.push('maxtrans', """
+[mta]
+max_sessions_per_connection: 3
+""")
+self.addCleanup(config.pop, 'maxtrans')
+
+def test_two_messages(self):
+msgdata = dict(recipients=['a...@example.org'])
+# Send a message.
+self._deliverer(self._mlist, self._msg, msgdata)
+# We should have made one SMTP connection.
+self.assertEqual(SMTPLayer.smtpd.get_connection_count(), 1)
+# Send a second message.
+msgdata = dict(recipients=['b...@example.org'])
+self._deliverer(self._mlist, self._msg, msgdata)
+# This should result in a second connection.
+self.assertEqual(SMTPLayer.smtpd.get_connection_count(), 2)
+
+def test_one_message_two_recip(self):
+msgdata = dict(recipients=['a...@example.org', 'b...@example.org'])
+# Send the message.
+self._deliverer(self._mlist, self._msg, msgdata)
+# Sending to 2 recips sends 2 messages because of personalization.
+# That's fewer than max_sessions_per_connect

[Mailman-checkins] [Git][mailman/mailman][master] 6 commits: Introduces explicit_header_only option

2019-01-12 Thread Mark Sapiro via Mailman-checkins
Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
317c0f68 by Nick Wynja at 2019-01-11T15:24:54Z
Introduces explicit_header_only option

Introduce option for not including list address in CC when replying.

Closes #531

- - - - -
2bd6c61d by Mark Sapiro at 2019-01-12T00:34:11Z
Update NEWS.rst
- - - - -
8b45e148 by Mark Sapiro at 2019-01-12T00:36:37Z
Update test_cook_headers.py
- - - - -
240d1479 by Nick Wynja at 2019-01-12T17:00:19Z
Merge branch 'patch-1' into 'master'

Update NEWS.rst

See merge request nickwynja/mailman!1
- - - - -
49389eab by Nick Wynja at 2019-01-12T17:00:36Z
Merge branch 'patch-2' into 'master'

Update test_cook_headers.py

See merge request nickwynja/mailman!2
- - - - -
1e959748 by Mark Sapiro at 2019-01-12T18:10:39Z
Merge branch 'master' into 'master'

Introduces explicit_header_only option

Closes #531

See merge request mailman/mailman!430
- - - - -


5 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/handlers/cook_headers.py
- src/mailman/handlers/docs/reply-to.rst
- src/mailman/handlers/tests/test_cook_headers.py
- src/mailman/interfaces/mailinglist.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -39,6 +39,8 @@ Other
 * Email commands are now case insensitive.  (Closes #353)
 * Implicit commands sent to -join, -leave and -confirm addresses no longer
   generate a Results email.  (Closes #516)
+* An ``explicit_header_only`` option has been added to Reply-To: munging to
+  avoid putting the list address in Cc:.  (Closes #531)
 
 
 3.2.0 -- "La Villa Strangiato"


=
src/mailman/handlers/cook_headers.py
=
@@ -105,8 +105,10 @@ def process(mlist, msg, msgdata):
 d[lcaddr] = pair
 new.append(pair)
 # List admin wants an explicit Reply-To: added
-if mlist.reply_goes_to_list is ReplyToMunging.explicit_header:
-add(parseaddr(mlist.reply_to_address))
+if (mlist.reply_goes_to_list is ReplyToMunging.explicit_header
+or mlist.reply_goes_to_list is
+ReplyToMunging.explicit_header_only):
+add(parseaddr(mlist.reply_to_address))
 # If we're not first stripping existing Reply-To: then we need to add
 # the original Reply-To:'s to the list we're building up.  In both
 # cases we'll zap the existing field because RFC 2822 says max one is
@@ -147,10 +149,14 @@ def process(mlist, msg, msgdata):
 d = {}
 for pair in getaddresses(msg.get_all('cc', [])):
 add(pair)
-i18ndesc = uheader(mlist, mlist.description, 'Cc')
-add((str(i18ndesc), mlist.posting_address))
+if (mlist.reply_goes_to_list is not
+ReplyToMunging.explicit_header_only):
+i18ndesc = uheader(mlist, mlist.description, 'Cc')
+add((str(i18ndesc), mlist.posting_address))
 del msg['Cc']
-msg['Cc'] = COMMASPACE.join([formataddr(pair) for pair in new])
+# Don't add an empty Cc:
+if new:
+msg['Cc'] = COMMASPACE.join([formataddr(pair) for pair in new])
 
 
 @public


=
src/mailman/handlers/docs/reply-to.rst
=
@@ -129,3 +129,29 @@ header...
 1
 >>> print(msg['reply-to'])
 my-l...@example.com, bper...@example.com
+
+
+Don't CC List Address in Reply
+==
+
+The default behavior of a personalized list is that a reply goes ``To``
+the message sender and the list address is added to ``Cc``.
+
+The list can be configured so that replying to a list message replies only
+to the explicit ``Reply-To`` header and does not include the list address
+in ``Cc``.
+
+>>> mlist.reply_goes_to_list = ReplyToMunging.explicit_header_only
+>>> mlist.reply_to_address = 'my-l...@example.com'
+>>> mlist.first_strip_reply_to = True
+>>> msg = message_from_string("""\
+... From: aper...@example.com
+... Reply-To: bper...@example.com
+... Cc: cper...@example.com
+...
+... """)
+>>> process(mlist, msg, {})
+>>> print(msg['reply-to'])
+my-l...@example.com
+>>> print(msg['cc'])
+cper...@example.com


=
src/mailman/handlers/tests/test_cook_headers.py
=
@@ -21,7 +21,7 @@ import unittest
 
 from mailman.app.lifecycle import create_list
 from mailman.handlers import cook_headers
-from mailman.interfaces.mailinglist import ReplyToMunging
+from mailman.interfaces.mailinglist import Personalization, ReplyToMunging
 from mailman.interfaces.member import DeliveryMode
 from mailman.testing.helpers import (
 LogFileMark, get_queue_messages, make_digest_messages,
@@ -107,5 +107,33 @@ X-Mailman-Version: X.Y
 Precedence: list
 Reply-To: =?utf-8?b?U29tZSBDb2ZmZWUg4

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Clean up some whitespace anomalies.

2019-01-10 Thread Mark Sapiro via Mailman-checkins
Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
bb769117 by Mark Sapiro at 2019-01-10T20:19:13Z
Clean up some whitespace anomalies.

- - - - -
4246f6d1 by Mark Sapiro at 2019-01-10T20:37:55Z
Merge branch 'clean_news' into 'master'

Clean up some whitespace anomalies.

See merge request mailman/mailman!431
- - - - -


1 changed file:

- src/mailman/docs/NEWS.rst


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -32,14 +32,13 @@ Bugs
 
 REST
 
-* Allow setting ``max_num_recipients`` for a mailing list. (Closes #508)
+* Allow setting ``max_num_recipients`` for a mailing list.  (Closes #508)
 
-  
 Other
 -
-* Email commands are now case insensitive. (Closes #353)
+* Email commands are now case insensitive.  (Closes #353)
 * Implicit commands sent to -join, -leave and -confirm addresses no longer
-  generate a Results email. (Closes #516)
+  generate a Results email.  (Closes #516)
 
 
 3.2.0 -- "La Villa Strangiato"



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/00c636766b1263ba2c7c687845fad0ca8fb9eb28...4246f6d155ff1b4beab5f048110777d1f4977765

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/00c636766b1263ba2c7c687845fad0ca8fb9eb28...4246f6d155ff1b4beab5f048110777d1f4977765
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: Properly decode message parts when trying to remove Approved:.

2018-10-29 Thread Mark Sapiro via Mailman-checkins
Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
2c71f67f by Mark Sapiro at 2018-10-30T01:00:55Z
Properly decode message parts when trying to remove Approved:.

- - - - -
31f1ecd9 by Mark Sapiro at 2018-10-30T01:29:05Z
Merge branch 'approve' into 'master'

Properly decode message parts when trying to remove Approved:.

Closes #518

See merge request mailman/mailman!416
- - - - -


3 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/rules/approved.py
- src/mailman/rules/tests/test_approved.py


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -27,6 +27,8 @@ Bugs
   (See !407)
 * Autoresponses to posts and -owner and -request messages now work.
   (Closes #504)
+* Message parts are now properly decoded when trying to remove an Approved:
+  header.  (Closes #518)
 
 REST
 


=
src/mailman/rules/approved.py
=
@@ -113,8 +113,17 @@ class Approved:
 # may not work with rtf or whatever else is possible.
 pattern = (header + r':(\s| )*' + re.escape(password))
 for part in typed_subpart_iterator(msg, 'text'):
-payload = part.get_payload()
+payload = part.get_payload(decode=True)
 if payload is not None:
+charset = part.get_content_charset('us-ascii')
+try:
+# Do the decoding inside the try/except so that if
+# the charset is unknown, we'll just drop back to
+# ascii.
+payload = payload.decode(charset, 'replace')
+except LookupError:
+# Unknown or empty charset.
+payload = payload.decode('us-ascii', 'replace')
 if re.search(pattern, payload):
 reset_payload(part, re.sub(pattern, '', payload))
 else:
@@ -138,7 +147,10 @@ def reset_payload(part, payload):
 delsp = part.get_param('delsp')
 del part['content-transfer-encoding']
 del part['content-type']
-part.set_payload(payload, charset)
+try:
+part.set_payload(payload, charset)
+except LookupError:
+part.set_payload(payload, 'us-ascii')
 part.set_type(content_type)
 if format:
 part.set_param('Format', format)


=
src/mailman/rules/tests/test_approved.py
=
@@ -531,3 +531,59 @@ Content-Transfer-Encoding: 7bit
 """)
 result = self._rule.check(self._mlist, msg, {})
 self.assertFalse(result)
+
+
+class TestProperDecodingOfAllParts(unittest.TestCase):
+"""Test that the approved handler properly decodes all message parts."""
+
+layer = ConfigLayer
+
+def setUp(self):
+self._mlist = create_list('t...@example.com')
+self._mlist.moderator_password = config.password_context.encrypt(
+'super secret')
+self._rule = approved.Approved()
+self._msg_text = """\
+From: a...@example.com
+To: t...@example.com
+Subject: A Message with non-ascii body
+Message-ID: 
+MIME-Version: 1.0
+Content-Type: multipart/alternative; boundary="AAA"
+
+--AAA
+Content-Type: text/plain
+Content-Transfer-Encoding: quoted-printable
+
+Approved: super secret
+The above line will be removed=21
+
+--AAA
+Content-Type: text/html{}
+Content-Transfer-Encoding: quoted-printable
+
+
+Approved:super=20secretThe =
+password approval will be removed=21
+
+"""
+
+def test_proper_decoding_mime(self):
+msg = mfs(self._msg_text.format(''))
+result = self._rule.check(self._mlist, msg, {})
+self.assertTrue(result)
+self.assertEqual(b'The above line will be removed!\n',
+ msg.get_payload(0).get_payload(decode=True))
+self.assertEqual(b'\nThe password '
+ b'approval will be removed!\n',
+ msg.get_payload(1).get_payload(decode=True))
+
+def test_proper_decoding_mime_unknown_charset(self):
+msg = mfs(self._msg_text.format('; charset="unknown-8bit"'))
+result = self._rule.check(self._mlist, msg, {})
+self.assertTrue(result)
+self.assertEqual(b'The above line will be removed!\n',
+ msg.get_payload(0).get_payload(decode=True))
+self.assertEqual(b'\nThe password '
+ b'approval will be removed!\n',
+ msg.get_payload(1).get_payload(decode=True))



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/5b983bcfcaa6a22bd0d991ae80e6d3acd5b8c9d9...31f1ecd9542515a60a01aedcfa9d775a124a32eb

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/5b983bcfcaa6a22bd0d991ae80e6d3acd5b8c9d9...31f1ecd9542515a60a01aedcfa9d775a124

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Enable setting additional templates in the var/templates hierarchy.

2018-09-11 Thread Mark Sapiro via Mailman-checkins
Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
8e7a6613 by Mark Sapiro at 2018-09-11T15:19:48Z
Enable setting additional templates in the var/templates hierarchy.

- - - - -
bb9222a5 by Mark Sapiro at 2018-09-11T15:34:19Z
Merge branch 'template' into 'master'

Enable setting additional templates in the var/templates hierarchy.

Closes #486

See merge request mailman/mailman!398
- - - - -


6 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/interfaces/template.py
- src/mailman/model/template.py
- + src/mailman/templates/en/list:member:digest:header.txt
- + src/mailman/templates/en/list:member:regular:header.txt
- + src/mailman/templates/en/list:user:notice:goodbye.txt


Changes:

=
src/mailman/docs/NEWS.rst
=
@@ -110,6 +110,8 @@ Bugs
   has been fixed to generate proper mappings in this case.  (Closes #485)
 * Fix a bug where duplicate address records can be created when a user adds an
   existing address with a different case. (Closes #476)
+* Several additional templates can now be set in the ``var/templates``
+  hierarchy.  (Closes #486)
 
 Command line
 


=
src/mailman/interfaces/template.py
=
@@ -159,7 +159,9 @@ class ITemplateManager(Interface):
 
 
 # Mapping of template names to their in-source file names.  A None value means
-# that there is no file in the tree for that template.
+# that there is no file in the tree for that template, but we have possibly
+# empty files for all templates so they can be defined in the var/templates
+# hierarchy.
 
 ALL_TEMPLATES = {
 key: '{}.txt'.format(key)
@@ -171,9 +173,14 @@ ALL_TEMPLATES = {
 'list:admin:notice:subscribe',
 'list:admin:notice:unrecognized',
 'list:admin:notice:unsubscribe',
+'list:member:digest:footer',
+'list:member:digest:header',
 'list:member:digest:masthead',
+'list:member:regular:footer',
+'list:member:regular:header',
 'list:user:action:subscribe',
 'list:user:action:unsubscribe',
+'list:user:notice:goodbye',
 'list:user:notice:hold',
 'list:user:notice:no-more-today',
 'list:user:notice:post',
@@ -184,18 +191,11 @@ ALL_TEMPLATES = {
 }
 }
 
-# These have other names.
-ALL_TEMPLATES.update({
+# These have alternate names.
+ALT_TEMPLATE_NAMES = {
 'list:member:digest:footer': 'list:member:generic:footer.txt',
 'list:member:regular:footer': 'list:member:generic:footer.txt',
-})
-
-# These are some extra supported templates which don't have a mapping to a
-# file in the source tree.
-ALL_TEMPLATES.update({
-'list:member:digest:header': None,
-'list:member:regular:header': None,
-'list:user:notice:goodbye':  None,
-})
+}
 
 public(ALL_TEMPLATES=ALL_TEMPLATES)
+public(ALT_TEMPLATE_NAMES=ALT_TEMPLATE_NAMES)


=
src/mailman/model/template.py
=
@@ -27,9 +27,9 @@ from mailman.interfaces.cache import ICacheManager
 from mailman.interfaces.domain import IDomain
 from mailman.interfaces.mailinglist import IMailingList
 from mailman.interfaces.template import (
-ALL_TEMPLATES, ITemplateLoader, ITemplateManager)
+ALL_TEMPLATES, ALT_TEMPLATE_NAMES, ITemplateLoader, ITemplateManager)
 from mailman.utilities import protocols
-from mailman.utilities.i18n import find
+from mailman.utilities.i18n import TemplateNotFoundError, find
 from mailman.utilities.string import expand
 from public import public
 from requests import HTTPError
@@ -197,10 +197,19 @@ class TemplateLoader:
 missing = object()
 default_uri = ALL_TEMPLATES.get(name, missing)
 if default_uri is None:
-return ''
+# Currently default_uri is never None, but leave this in case
+# of a future change.
+return ''   # pragma: nocover
 elif default_uri is missing:
 raise URLError('No such file')
-path, fp = find(default_uri, mlist, code)
+try:
+path, fp = find(default_uri, mlist, code)
+except TemplateNotFoundError:
+default_uri = ALT_TEMPLATE_NAMES.get(name, missing)
+if default_uri is missing:
+# Here again, default_uri is never missing, but leave it.
+raise   # pragma: nocover
+path, fp = find(default_uri, mlist, code)
 try:
 return fp.read()
 finally:


=
src/mailman/templates/en/list:member:digest:header.txt
=


=
src/mailman/templates/en/list:member:regular:header.txt
=


=
src/mailman/templates/en

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Import autorespond_postings and autorespond_admin correctly.

2018-08-11 Thread Mark Sapiro via Mailman-checkins
Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
7e7e317a by Mark Sapiro at 2018-08-11T19:23:09Z
Import autorespond_postings and autorespond_admin correctly.

- - - - -
d87980b0 by Mark Sapiro at 2018-08-11T21:03:53Z
Merge branch 'import' into 'master'

Import autorespond settings correctly.

Closes #505

See merge request mailman/mailman!409
- - - - -


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
=
@@ -16,6 +16,8 @@ Command line
 
 * The ``mailman import21`` command properly converts all acceptable_aliases
   to regexps.  (Closes #496)
+* The ``mailman import21`` command correctly converts autorespond_* settings.
+  (Closes #505)
 
 Bugs
 
@@ -24,6 +26,7 @@ Bugs
 * Autoresponses to posts and -owner and -request messages now work.
   (Closes #504)
 
+
 3.2.0 -- "La Villa Strangiato"
 ==
 (2018-07-10)


=
src/mailman/utilities/importer.py
=
@@ -87,6 +87,12 @@ def list_members_to_unicode(value):
 return [bytes_to_str(item) for item in value]
 
 
+def autoresponder_mapping(value):
+if value:
+return ResponseAction.respond_and_continue
+return ResponseAction.none
+
+
 def dmarc_action_mapping(value):
 # Convert dmarc_moderation_action to a DMARCMitigateAction enum.
 # 2.1 actions are 0==accept, 1==Munge From, 2==Wrap Message,
@@ -175,8 +181,8 @@ enabled: yes
 # Attributes in Mailman 2 which have a different type in Mailman 3.  Some
 # types (e.g. bools) are autodetected from their SA column types.
 TYPES = dict(
-autorespond_owner=ResponseAction,
-autorespond_postings=ResponseAction,
+autorespond_owner=autoresponder_mapping,
+autorespond_postings=autoresponder_mapping,
 autorespond_requests=ResponseAction,
 autoresponse_grace_period=days_to_delta,
 bounce_info_stale_after=seconds_to_delta,


=
src/mailman/utilities/tests/test_import.py
=
@@ -136,6 +136,73 @@ class TestBasicImport(unittest.TestCase):
 self.assertEqual(self._mlist.autorespond_owner, ResponseAction.none)
 self.assertEqual(self._mlist.autoresponse_owner_text, '')
 
+def test_autoresponse_owner_yes(self):
+# Yes -> ResponseAction.respond_and_continue
+self._mlist.autorespond_owner = DummyEnum.val
+self._mlist.autoresponse_owner_text = 'DUMMY'
+self._pckdict['autorespond_admin'] = 1
+self._pckdict['autoresponse_admin_text'] = 'Autoresponse'
+self._import()
+self.assertEqual(self._mlist.autorespond_owner,
+ ResponseAction.respond_and_continue)
+self.assertEqual(self._mlist.autoresponse_owner_text, 'Autoresponse')
+
+def test_autoresponse_post_yes(self):
+# Yes -> ResponseAction.respond_and_continue
+self._mlist.autorespond_postings = DummyEnum.val
+self._mlist.autoresponse_postings_text = 'DUMMY'
+self._pckdict['autorespond_postings'] = 1
+self._pckdict['autoresponse_postings_text'] = 'Autoresponse'
+self._import()
+self.assertEqual(self._mlist.autorespond_postings,
+ ResponseAction.respond_and_continue)
+self.assertEqual(self._mlist.autoresponse_postings_text,
+ 'Autoresponse')
+
+def test_autoresponse_post_no(self):
+# No -> ResponseAction.none
+self._mlist.autorespond_postings = DummyEnum.val
+self._mlist.autoresponse_postings_text = 'DUMMY'
+self._pckdict['autorespond_postings'] = 0
+self._import()
+self.assertEqual(self._mlist.autorespond_postings,
+ ResponseAction.none)
+self.assertEqual(self._mlist.autoresponse_postings_text, '')
+
+def test_autoresponse_request_continue(self):
+# Yes, w/forward -> ResponseAction.respond_and_continue
+self._mlist.autorespond_requests = DummyEnum.val
+self._mlist.autoresponse_request_text = 'DUMMY'
+self._pckdict['autorespond_requests'] = 2
+self._pckdict['autoresponse_request_text'] = 'Autoresponse'
+self._import()
+self.assertEqual(self._mlist.autorespond_requests,
+ ResponseAction.respond_and_continue)
+self.assertEqual(self._mlist.autoresponse_request_text,
+ 'Autoresponse')
+
+def test_autoresponse_request_discard(self):
+# Yes, w/discard -> ResponseAction.respond_and_discard
+self._mlist.autorespond_requests = DummyEnum.val
+self._mlist.autoresponse_request_text = 'DUMMY'
+self._pckdict['autorespond_requests'] = 1
+self._pckdict['autoresponse_request_text'] = 'Autoresponse'
+self.

[Mailman-checkins] [Git][mailman/mailman][master] 2 commits: Import all acceptable_aliases as regexps.

2018-07-27 Thread Mark Sapiro via Mailman-checkins
Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
5ae34e81 by Mark Sapiro at 2018-07-27T03:28:16Z
Import all acceptable_aliases as regexps.

- - - - -
55443b04 by Mark Sapiro at 2018-07-27T16:45:09Z
Merge branch 'import' into 'master'

Import all acceptable_aliases as regexps.

Closes #496

See merge request mailman/mailman!406
- - - - -


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
=
@@ -10,6 +10,12 @@ Here is a history of user visible changes to Mailman.
 
 3.3.0 -- "Tom Sawyer"
 =
+(20xx-xx-xx)
+
+Command line
+
+* The ``mailman import21`` command properly converts all acceptable_aliases
+  to regexps.  (Closes #496)
 
 
 3.2.0 -- "La Villa Strangiato"


=
src/mailman/utilities/importer.py
=
@@ -351,12 +351,14 @@ def import_config_pck(mlist, config_dict):
 if len(address) == 0:
 continue
 address = bytes_to_str(address)
-try:
-alias_set.add(address)
-except ValueError:
-# When .add() rejects this, the line probably contains a regular
-# expression.  Make that explicit for MM3.
-alias_set.add('^' + address)
+# All 2.1 acceptable aliases are regexps whether or not they start
+# with '^' or contain '@'.
+if not address.startswith('^'):
+address = '^' + address
+# This used to be in a try which would catch ValueError and add a '^',
+# but .add() would not raise ValueError if address contained '@' and
+# that needs the '^' too as it could be a regexp with an '@' in it.
+alias_set.add(address)
 # Handle header_filter_rules conversion to header_matches.
 header_matches = IHeaderMatchList(mlist)
 header_filter_rules = config_dict.get('header_filter_rules', [])


=
src/mailman/utilities/tests/test_import.py
=
@@ -265,7 +265,9 @@ class TestBasicImport(unittest.TestCase):
 self.assertTrue(IBanManager(self._mlist).is_banned(addr))
 
 def test_acceptable_aliases(self):
-# This used to be a plain-text field (values are newline-separated).
+# This used to be a plain-text field (values are newline-separated)
+# but values were interpreted as regexps even without '^' so we need
+# to add the '^'.
 aliases = ['ali...@example.com',
'ali...@exemple.com',
'non-ascii-\x...@example.com',
@@ -273,7 +275,8 @@ class TestBasicImport(unittest.TestCase):
 self._pckdict['acceptable_aliases'] = list_to_string(aliases)
 self._import()
 alias_set = IAcceptableAliasSet(self._mlist)
-self.assertEqual(sorted(alias_set.aliases), aliases)
+self.assertEqual(sorted(alias_set.aliases),
+ [('^' + alias) for alias in aliases])
 
 def test_acceptable_aliases_invalid(self):
 # Values without an '@' sign used to be matched against the local
@@ -287,13 +290,23 @@ class TestBasicImport(unittest.TestCase):
 
 def test_acceptable_aliases_as_list(self):
 # In some versions of the pickle, this can be a list, not a string
-# (seen in the wild).
+# (seen in the wild).  We still need to add the '^'.
 aliases = [b'ali...@example.com', b'ali...@exemple.com']
 self._pckdict['acceptable_aliases'] = aliases
 self._import()
 alias_set = IAcceptableAliasSet(self._mlist)
 self.assertEqual(sorted(alias_set.aliases),
- sorted(a.decode('utf-8') for a in aliases))
+ sorted(('^' + a.decode('utf-8')) for a in aliases))
+
+def test_dont_add_caret_if_present(self):
+# The 2.1 alias could have had a leading '^' even though not required.
+aliases = ['^ali...@example.com',
+   '^alias2@.*',
+   ]
+self._pckdict['acceptable_aliases'] = list_to_string(aliases)
+self._import()
+alias_set = IAcceptableAliasSet(self._mlist)
+self.assertEqual(sorted(alias_set.aliases), aliases)
 
 def test_info_non_ascii(self):
 # info can contain non-ascii characters.



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/6aecc2d65dd37d06fac640dae62dc45c16901516...55443b04ff185ca908b1dcd8261d8b2d0f67626e

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/6aecc2d65dd37d06fac640dae62dc45c16901516...55443b04ff185ca908b1dcd8261d8b2d0f67626e
You're receiving this email because of your account on gitlab.com.
___
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.p

  1   2   >