Barry Warsaw pushed to branch master at mailman / Mailman
Commits:
af5df60a by Barry Warsaw at 2016-01-25T15:08:43-05:00
Boost coverage.
Also, ignore `raise AssertionError` lines globally.
- - - - -
6c3df829 by Barry Warsaw at 2016-01-25T15:08:43-05:00
Boost coverage and remove dead code.
- - - - -
e2e962ab by Barry Warsaw at 2016-01-25T15:08:43-05:00
Full coverage of the accept chain.
Fix some comments.
- - - - -
57a07393 by Barry Warsaw at 2016-01-25T15:24:48-05:00
Use the more convenient API.
- - - - -
802ce668 by Barry Warsaw at 2016-01-26T15:32:19-05:00
Super duper.
* Python 3-ify super() calls.
* Remove a bunch of obsolete exception classes.
- - - - -
37 changed files:
- coverage.ini
- src/mailman/app/bounces.py
- src/mailman/app/membership.py
- src/mailman/app/tests/test_workflow.py
- src/mailman/app/workflow.py
- src/mailman/chains/headers.py
- + src/mailman/chains/tests/test_accept.py
- src/mailman/chains/tests/test_reject.py
- src/mailman/compat/smtpd.py
- src/mailman/core/errors.py
- src/mailman/database/postgresql.py
- src/mailman/database/types.py
- src/mailman/interfaces/address.py
- src/mailman/interfaces/domain.py
- src/mailman/interfaces/member.py
- src/mailman/interfaces/mta.py
- src/mailman/model/address.py
- src/mailman/model/bans.py
- src/mailman/model/mailinglist.py
- src/mailman/model/message.py
- src/mailman/model/requests.py
- src/mailman/model/tests/test_mailinglist.py
- src/mailman/model/user.py
- src/mailman/mta/base.py
- src/mailman/mta/bulk.py
- src/mailman/mta/decorating.py
- src/mailman/mta/deliver.py
- src/mailman/mta/personalized.py
- src/mailman/mta/verp.py
- src/mailman/rest/helpers.py
- src/mailman/rest/validator.py
- src/mailman/runners/bounce.py
- src/mailman/runners/digest.py
- src/mailman/runners/lmtp.py
- src/mailman/runners/outgoing.py
- src/mailman/runners/rest.py
- src/mailman/testing/helpers.py
Changes:
=====================================
coverage.ini
=====================================
--- a/coverage.ini
+++ b/coverage.ini
@@ -12,6 +12,7 @@ omit =
exclude_lines =
pragma: no cover
raise NotImplementedError
+ raise AssertionError
assert\s
[paths]
=====================================
src/mailman/app/bounces.py
=====================================
--- a/src/mailman/app/bounces.py
+++ b/src/mailman/app/bounces.py
@@ -146,7 +146,7 @@ class _BaseVERPParser:
class StandardVERP(_BaseVERPParser):
def __init__(self):
- super(StandardVERP, self).__init__(config.mta.verp_regexp)
+ super().__init__(config.mta.verp_regexp)
def _get_address(self, match_object):
return '{0}@{1}'.format(*match_object.group('local', 'domain'))
@@ -154,7 +154,7 @@ class StandardVERP(_BaseVERPParser):
class ProbeVERP(_BaseVERPParser):
def __init__(self):
- super(ProbeVERP, self).__init__(config.mta.verp_probe_regexp)
+ super().__init__(config.mta.verp_probe_regexp)
def _get_address(self, match_object):
# Extract the token and get the matching address.
=====================================
src/mailman/app/membership.py
=====================================
--- a/src/mailman/app/membership.py
+++ b/src/mailman/app/membership.py
@@ -79,7 +79,7 @@ def add_member(mlist, record, role=MemberRole.member):
for address in user.addresses:
if address.original_email == record.email:
case_preserved = address
- if address.email == record.email.lower():
+ if address.email == record.email.lower(): # pragma: no branch
case_insensitive = address
assert case_preserved is not None or case_insensitive is not None, (
'Could not find a linked address for: {}'.format(record.email))
=====================================
src/mailman/app/tests/test_workflow.py
=====================================
--- a/src/mailman/app/tests/test_workflow.py
+++ b/src/mailman/app/tests/test_workflow.py
@@ -122,7 +122,15 @@ class TestWorkflow(unittest.TestCase):
results = self._workflow.run_thru('second')
self.assertEqual(results, ['one', 'two'])
+ def test_run_thru_completes(self):
+ results = self._workflow.run_thru('all of them')
+ self.assertEqual(results, ['one', 'two', 'three'])
+
def test_run_until(self):
# Run until (but not including) the given step.
results = self._workflow.run_until('second')
self.assertEqual(results, ['one'])
+
+ def test_run_until_completes(self):
+ results = self._workflow.run_until('all of them')
+ self.assertEqual(results, ['one', 'two', 'three'])
=====================================
src/mailman/app/workflow.py
=====================================
--- a/src/mailman/app/workflow.py
+++ b/src/mailman/app/workflow.py
@@ -63,7 +63,7 @@ class Workflow:
name = self._next.popleft()
step = getattr(self, '_step_{}'.format(name))
self._count += 1
- if self.debug:
+ if self.debug: # pragma: no cover
print('[{:02d}] -> {}'.format(self._count, name), file=sys.stderr)
return name, step
@@ -151,6 +151,5 @@ class Workflow:
self._next.clear()
if state.step:
self._next.append(state.step)
- if state.data is not None:
- for attr, value in json.loads(state.data).items():
- setattr(self, attr, value)
+ for attr, value in json.loads(state.data).items():
+ setattr(self, attr, value)
=====================================
src/mailman/chains/headers.py
=====================================
--- a/src/mailman/chains/headers.py
+++ b/src/mailman/chains/headers.py
@@ -104,7 +104,7 @@ class HeaderMatchChain(Chain):
"""
def __init__(self):
- super(HeaderMatchChain, self).__init__(
+ super().__init__(
'header-match', _('The built-in header matching chain'))
# This chain will dynamically calculate the links from the
# configuration file, the database, and any explicitly added header
=====================================
src/mailman/chains/tests/test_accept.py
=====================================
--- /dev/null
+++ b/src/mailman/chains/tests/test_accept.py
@@ -0,0 +1,75 @@
+# Copyright (C) 2016 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 <http://www.gnu.org/licenses/>.
+
+"""Test the accept chain."""
+
+__all__ = [
+ 'TestAccept',
+ ]
+
+
+import unittest
+
+from mailman.app.lifecycle import create_list
+from mailman.chains.base import Link
+from mailman.config import config
+from mailman.core.chains import process as process_chain
+from mailman.interfaces.chain import AcceptEvent, IChain, LinkAction
+from mailman.testing.helpers import (
+ event_subscribers, specialized_message_from_string as mfs)
+from mailman.testing.layers import ConfigLayer
+from zope.interface import implementer
+
+
+@implementer(IChain)
+class MyChain:
+ name = 'mine'
+ description = 'A test chain'
+
+ def get_links(self, mlist, msg, msgdata):
+ def set_hits(mlist, msg, msgdata):
+ msgdata['rule_hits'] = ['first', 'second', 'third']
+ yield Link('truth', LinkAction.run, function=set_hits)
+ yield Link('truth', LinkAction.jump, 'accept')
+
+
+
+class TestAccept(unittest.TestCase):
+ """Test the accept chain."""
+
+ layer = ConfigLayer
+
+ def setUp(self):
+ self._mlist = create_list('[email protected]')
+ self._msg = mfs("""\
+From: [email protected]
+To: [email protected]
+Subject: Ignore
+
+""")
+
+ def test_rule_hits(self):
+ config.chains['mine'] = MyChain()
+ self.addCleanup(config.chains.pop, 'mine')
+ hits = None
+ def handler(event):
+ nonlocal hits
+ if isinstance(event, AcceptEvent):
+ hits = event.msg['x-mailman-rule-hits']
+ with event_subscribers(handler):
+ process_chain(self._mlist, self._msg, {}, start_chain='mine')
+ self.assertEqual(hits, 'first; second; third')
=====================================
src/mailman/chains/tests/test_reject.py
=====================================
--- a/src/mailman/chains/tests/test_reject.py
+++ b/src/mailman/chains/tests/test_reject.py
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License along with
# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
-"""Testing the reject chain."""
+"""Test the reject chain."""
__all__ = [
'TestReject',
@@ -33,7 +33,7 @@ from mailman.testing.layers import ConfigLayer
class TestReject(unittest.TestCase):
- """Test the `mailman.app.bounces.bounce_message()` function."""
+ """Test the reject chain."""
layer = ConfigLayer
=====================================
src/mailman/compat/smtpd.py
=====================================
--- a/src/mailman/compat/smtpd.py
+++ b/src/mailman/compat/smtpd.py
@@ -748,7 +748,7 @@ class PureProxy(SMTPServer):
def __init__(self, *args, **kwargs):
if 'enable_SMTPUTF8' in kwargs and kwargs['enable_SMTPUTF8']:
raise ValueError("PureProxy does not support SMTPUTF8.")
- super(PureProxy, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
def process_message(self, peer, mailfrom, rcpttos, data):
lines = data.split('\n')
@@ -793,7 +793,7 @@ class MailmanProxy(PureProxy):
def __init__(self, *args, **kwargs):
if 'enable_SMTPUTF8' in kwargs and kwargs['enable_SMTPUTF8']:
raise ValueError("MailmanProxy does not support SMTPUTF8.")
- super(PureProxy, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
def process_message(self, peer, mailfrom, rcpttos, data):
from io import StringIO
=====================================
src/mailman/core/errors.py
=====================================
--- a/src/mailman/core/errors.py
+++ b/src/mailman/core/errors.py
@@ -27,19 +27,10 @@ interfaces.
__all__ = [
- 'AlreadyReceivingDigests',
- 'AlreadyReceivingRegularDeliveries',
- 'BadPasswordSchemeError',
- 'CantDigestError',
'DiscardMessage',
'HandlerError',
'HoldMessage',
'LostHeldMessage',
- 'MailmanError',
- 'MailmanException',
- 'MemberError',
- 'MustDigestError',
- 'PasswordError',
'RESTError',
'ReadOnlyPATCHRequestError',
'RejectMessage',
@@ -101,22 +92,6 @@ class RejectMessage(HandlerError):
-class PasswordError(MailmanError):
- """A password related error."""
-
-
-class BadPasswordSchemeError(PasswordError):
- """A bad password scheme was given."""
-
- def __init__(self, scheme_name='unknown'):
- super(BadPasswordSchemeError, self).__init__()
- self.scheme_name = scheme_name
-
- def __str__(self):
- return 'A bad password scheme was given: %s' % self.scheme_name
-
-
-
class RESTError(MailmanError):
"""Base class for REST API errors."""
=====================================
src/mailman/database/postgresql.py
=====================================
--- a/src/mailman/database/postgresql.py
+++ b/src/mailman/database/postgresql.py
@@ -37,7 +37,7 @@ class PostgreSQLDatabase(SABaseDatabase):
Reset the <tablename>_id_seq.last_value so that primary key ids
restart from zero for new tests.
"""
- super(PostgreSQLDatabase, self)._post_reset(store)
+ super()._post_reset(store)
tables = reversed(Model.metadata.sorted_tables)
# Recipe adapted from
# http://stackoverflow.com/questions/544791/
=====================================
src/mailman/database/types.py
=====================================
--- a/src/mailman/database/types.py
+++ b/src/mailman/database/types.py
@@ -40,8 +40,8 @@ class Enum(TypeDecorator):
impl = Integer
def __init__(self, enum, *args, **kw):
+ super().__init__(*args, **kw)
self.enum = enum
- super(Enum, self).__init__(*args, **kw)
def process_bind_param(self, value, dialect):
if value is None:
=====================================
src/mailman/interfaces/address.py
=====================================
--- a/src/mailman/interfaces/address.py
+++ b/src/mailman/interfaces/address.py
@@ -39,7 +39,7 @@ class EmailError(MailmanError):
"""A generic text email address-related error occurred."""
def __init__(self, email):
- super(EmailError, self).__init__()
+ super().__init__()
self.email = email
def __str__(self):
@@ -50,7 +50,7 @@ class AddressError(MailmanError):
"""A generic IAddress-related error occurred."""
def __init__(self, address):
- super(AddressError, self).__init__()
+ super().__init__()
self.address = address
def __str__(self):
=====================================
src/mailman/interfaces/domain.py
=====================================
--- a/src/mailman/interfaces/domain.py
+++ b/src/mailman/interfaces/domain.py
@@ -37,7 +37,7 @@ class BadDomainSpecificationError(MailmanError):
"""The specification of a virtual domain is invalid or duplicated."""
def __init__(self, domain):
- super(BadDomainSpecificationError, self).__init__(domain)
+ super().__init__(domain)
self.domain = domain
=====================================
src/mailman/interfaces/member.py
=====================================
--- a/src/mailman/interfaces/member.py
+++ b/src/mailman/interfaces/member.py
@@ -109,7 +109,7 @@ class AlreadySubscribedError(MembershipError):
"""The member is already subscribed to the mailing list with this role."""
def __init__(self, fqdn_listname, email, role):
- super(AlreadySubscribedError, self).__init__()
+ super().__init__()
self.fqdn_listname = fqdn_listname
self.email = email
self.role = role
@@ -136,7 +136,7 @@ class MissingPreferredAddressError(MembershipError):
"""A user without a preferred address attempted to subscribe."""
def __init__(self, user):
- super(MissingPreferredAddressError, self).__init__()
+ super().__init__()
self._user = user
def __str__(self):
@@ -147,7 +147,7 @@ class NotAMemberError(MembershipError):
"""The address is not a member of the mailing list."""
def __init__(self, mlist, address):
- super(NotAMemberError, self).__init__()
+ super().__init__()
self._mlist = mlist
self._address = address
=====================================
src/mailman/interfaces/mta.py
=====================================
--- a/src/mailman/interfaces/mta.py
+++ b/src/mailman/interfaces/mta.py
@@ -32,7 +32,7 @@ from zope.interface import Interface
class SomeRecipientsFailed(MailmanError):
"""Delivery to some or all recipients failed"""
def __init__(self, temporary_failures, permanent_failures):
- super(SomeRecipientsFailed, self).__init__()
+ super().__init__()
self.temporary_failures = temporary_failures
self.permanent_failures = permanent_failures
=====================================
src/mailman/model/address.py
=====================================
--- a/src/mailman/model/address.py
+++ b/src/mailman/model/address.py
@@ -55,7 +55,7 @@ class Address(Model):
'Preferences', backref=backref('address', uselist=False))
def __init__(self, email, display_name):
- super(Address, self).__init__()
+ super().__init__()
getUtility(IEmailValidator).validate(email)
lower_case = email.lower()
self.email = lower_case
=====================================
src/mailman/model/bans.py
=====================================
--- a/src/mailman/model/bans.py
+++ b/src/mailman/model/bans.py
@@ -43,7 +43,7 @@ class Ban(Model):
list_id = Column(Unicode, index=True)
def __init__(self, email, list_id):
- super(Ban, self).__init__()
+ super().__init__()
self.email = email
self.list_id = list_id
=====================================
src/mailman/model/mailinglist.py
=====================================
--- a/src/mailman/model/mailinglist.py
+++ b/src/mailman/model/mailinglist.py
@@ -190,7 +190,7 @@ class MailingList(Model):
welcome_message_uri = Column(Unicode)
def __init__(self, fqdn_listname):
- super(MailingList, self).__init__()
+ super().__init__()
listname, at, hostname = fqdn_listname.partition('@')
assert hostname, 'Bad list name: {0}'.format(fqdn_listname)
self.list_name = listname
@@ -511,7 +511,7 @@ class AcceptableAlias(Model):
alias = Column(Unicode, index=True, nullable=False)
def __init__(self, mailing_list, alias):
- super(AcceptableAlias, self).__init__()
+ super().__init__()
self.mailing_list = mailing_list
self.alias = alias
=====================================
src/mailman/model/message.py
=====================================
--- a/src/mailman/model/message.py
+++ b/src/mailman/model/message.py
@@ -44,7 +44,7 @@ class Message(Model):
@dbconnection
def __init__(self, store, message_id, message_id_hash, path):
- super(Message, self).__init__()
+ super().__init__()
self.message_id = message_id
self.message_id_hash = message_id_hash
self.path = path
=====================================
src/mailman/model/requests.py
=====================================
--- a/src/mailman/model/requests.py
+++ b/src/mailman/model/requests.py
@@ -56,7 +56,7 @@ class DataPendable(dict):
key = '_pck_' + key
value = dumps(value).decode('raw-unicode-escape')
clean_mapping[key] = value
- super(DataPendable, self).update(clean_mapping)
+ super().update(clean_mapping)
@@ -159,7 +159,7 @@ class _Request(Model):
mailing_list = relationship('MailingList')
def __init__(self, key, request_type, mailing_list, data_hash):
- super(_Request, self).__init__()
+ super().__init__()
self.key = key
self.request_type = request_type
self.mailing_list = mailing_list
=====================================
src/mailman/model/tests/test_mailinglist.py
=====================================
--- a/src/mailman/model/tests/test_mailinglist.py
+++ b/src/mailman/model/tests/test_mailinglist.py
@@ -36,7 +36,7 @@ from mailman.interfaces.mailinglist import (
from mailman.interfaces.member import (
AlreadySubscribedError, MemberRole, MissingPreferredAddressError)
from mailman.interfaces.usermanager import IUserManager
-from mailman.testing.helpers import configuration
+from mailman.testing.helpers import configuration, get_queue_messages
from mailman.testing.layers import ConfigLayer
from mailman.utilities.datetime import now
from zope.component import getUtility
@@ -86,6 +86,23 @@ class TestMailingList(unittest.TestCase):
def test_subscribe_argument(self):
self.assertRaises(ValueError, self._mlist.subscribe, 'anne')
+ def test_subscribe_by_user_admin_notification(self):
+ # A notification is sent to the administrator with the user's email
+ # address when a user is subscribed instead of an explicit address.
+ self._mlist.send_welcome_message = False
+ self._mlist.admin_notify_mchanges = True
+ manager = getUtility(IUserManager)
+ user = manager.make_user('[email protected]', 'Anne Person')
+ address = manager.create_address('[email protected]', 'A. Person')
+ address.verified_on = now()
+ user.preferred_address = address
+ self._mlist.subscribe(user)
+ # The welcome message was sent to the preferred address.
+ items = get_queue_messages('virgin')
+ self.assertEqual(len(items), 1)
+ self.assertIn('Anne Person <[email protected]>',
+ items[0].msg.get_payload())
+
class TestListArchiver(unittest.TestCase):
=====================================
src/mailman/model/user.py
=====================================
--- a/src/mailman/model/user.py
+++ b/src/mailman/model/user.py
@@ -78,7 +78,7 @@ class User(Model):
@dbconnection
def __init__(self, store, display_name=None, preferences=None):
- super(User, self).__init__()
+ super().__init__()
self._created_on = date_factory.now()
user_id = uid_factory.new()
assert store.query(User).filter_by(_user_id=user_id).count() == 0, (
=====================================
src/mailman/mta/base.py
=====================================
--- a/src/mailman/mta/base.py
+++ b/src/mailman/mta/base.py
@@ -134,7 +134,7 @@ class IndividualDelivery(BaseDelivery):
def __init__(self):
"""See `BaseDelivery`."""
- super(IndividualDelivery, self).__init__()
+ super().__init__()
self.callbacks = []
def deliver(self, mlist, msg, msgdata):
=====================================
src/mailman/mta/bulk.py
=====================================
--- a/src/mailman/mta/bulk.py
+++ b/src/mailman/mta/bulk.py
@@ -50,7 +50,7 @@ class BulkDelivery(BaseDelivery):
big chunk.
:type max_recipients: integer
"""
- super(BulkDelivery, self).__init__()
+ super().__init__()
self._max_recipients = (max_recipients
if max_recipients is not None
else 0)
=====================================
src/mailman/mta/decorating.py
=====================================
--- a/src/mailman/mta/decorating.py
+++ b/src/mailman/mta/decorating.py
@@ -45,5 +45,5 @@ class DecoratingDelivery(DecoratingMixin, VERPDelivery):
def __init__(self):
"""See `IndividualDelivery`."""
- super(DecoratingDelivery, self).__init__()
+ super().__init__()
self.callbacks.append(self.decorate)
=====================================
src/mailman/mta/deliver.py
=====================================
--- a/src/mailman/mta/deliver.py
+++ b/src/mailman/mta/deliver.py
@@ -54,7 +54,7 @@ class Deliver(VERPMixin, DecoratingMixin, PersonalizedMixin,
"""
def __init__(self):
- super(Deliver, self).__init__()
+ super().__init__()
self.callbacks.extend([
self.avoid_duplicates,
self.decorate,
=====================================
src/mailman/mta/personalized.py
=====================================
--- a/src/mailman/mta/personalized.py
+++ b/src/mailman/mta/personalized.py
@@ -69,5 +69,5 @@ class PersonalizedDelivery(PersonalizedMixin, VERPDelivery):
def __init__(self):
"""See `IndividualDelivery`."""
- super(PersonalizedDelivery, self).__init__()
+ super().__init__()
self.callbacks.append(self.personalize_to)
=====================================
src/mailman/mta/verp.py
=====================================
--- a/src/mailman/mta/verp.py
+++ b/src/mailman/mta/verp.py
@@ -53,7 +53,7 @@ class VERPMixin:
:param msgdata: Additional message metadata for this delivery.
:type msgdata: dictionary
"""
- sender = super(VERPMixin, self)._get_sender(mlist, msg, msgdata)
+ sender = super()._get_sender(mlist, msg, msgdata)
if msgdata.get('verp', False):
log.debug('VERPing %s', msg.get('message-id'))
recipient = msgdata['recipient']
@@ -96,5 +96,5 @@ class VERPDelivery(VERPMixin, IndividualDelivery):
def __init__(self):
"""See `IndividualDelivery`."""
- super(VERPDelivery, self).__init__()
+ super().__init__()
self.callbacks.append(self.avoid_duplicates)
=====================================
src/mailman/rest/helpers.py
=====================================
--- a/src/mailman/rest/helpers.py
+++ b/src/mailman/rest/helpers.py
@@ -254,12 +254,12 @@ class ChildError:
class BadRequest(ChildError):
def __init__(self):
- super(BadRequest, self).__init__(falcon.HTTP_400)
+ super().__init__(falcon.HTTP_400)
class NotFound(ChildError):
def __init__(self):
- super(NotFound, self).__init__(falcon.HTTP_404)
+ super().__init__(falcon.HTTP_404)
def okay(response, body=None):
=====================================
src/mailman/rest/validator.py
=====================================
--- a/src/mailman/rest/validator.py
+++ b/src/mailman/rest/validator.py
@@ -180,4 +180,4 @@ class PatchValidator(Validator):
if converters[attribute].decoder is None:
raise ReadOnlyPATCHRequestError(attribute)
validationators[attribute] = converters[attribute]
- super(PatchValidator, self).__init__(**validationators)
+ super().__init__(**validationators)
=====================================
src/mailman/runners/bounce.py
=====================================
--- a/src/mailman/runners/bounce.py
+++ b/src/mailman/runners/bounce.py
@@ -37,7 +37,7 @@ class BounceRunner(Runner):
"""The bounce runner."""
def __init__(self, name, slice=None):
- super(BounceRunner, self).__init__(name, slice)
+ super().__init__(name, slice)
self._processor = getUtility(IBounceProcessor)
def _dispose(self, mlist, msg, msgdata):
=====================================
src/mailman/runners/digest.py
=====================================
--- a/src/mailman/runners/digest.py
+++ b/src/mailman/runners/digest.py
@@ -151,7 +151,7 @@ class MIMEDigester(Digester):
"""A MIME digester."""
def __init__(self, mlist, volume, digest_number):
- super(MIMEDigester, self).__init__(mlist, volume, digest_number)
+ super().__init__(mlist, volume, digest_number)
masthead = MIMEText(self._masthead.encode(self._charset),
_charset=self._charset)
masthead['Content-Description'] = self._subject
@@ -215,7 +215,7 @@ class RFC1153Digester(Digester):
"""A digester of the format specified by RFC 1153."""
def __init__(self, mlist, volume, digest_number):
- super(RFC1153Digester, self).__init__(mlist, volume, digest_number)
+ super().__init__(mlist, volume, digest_number)
self._separator70 = '-' * 70
self._separator30 = '-' * 30
self._text = StringIO()
=====================================
src/mailman/runners/lmtp.py
=====================================
--- a/src/mailman/runners/lmtp.py
+++ b/src/mailman/runners/lmtp.py
@@ -171,7 +171,7 @@ class LMTPRunner(Runner, smtpd.SMTPServer):
qlog.debug('LMTP server listening on %s:%s',
localaddr[0], localaddr[1])
smtpd.SMTPServer.__init__(self, localaddr, remoteaddr=None)
- super(LMTPRunner, self).__init__(name, slice)
+ super().__init__(name, slice)
def handle_accept(self):
conn, addr = self.accept()
=====================================
src/mailman/runners/outgoing.py
=====================================
--- a/src/mailman/runners/outgoing.py
+++ b/src/mailman/runners/outgoing.py
@@ -54,7 +54,7 @@ class OutgoingRunner(Runner):
"""The outgoing runner."""
def __init__(self, slice=None, numslices=1):
- super(OutgoingRunner, self).__init__(slice, numslices)
+ super().__init__(slice, numslices)
# We look this function up only at startup time.
self._func = find_name(config.mta.outgoing)
# This prevents smtp server connection problems from filling up the
=====================================
src/mailman/runners/rest.py
=====================================
--- a/src/mailman/runners/rest.py
+++ b/src/mailman/runners/rest.py
@@ -41,7 +41,7 @@ class RESTRunner(Runner):
def __init__(self, name, slice=None):
"""See `IRunner`."""
- super(RESTRunner, self).__init__(name, slice)
+ super().__init__(name, slice)
# Both the REST server and the signal handlers must run in the main
# thread; the former because of SQLite requirements (objects created
# in one thread cannot be shared with the other threads), and the
@@ -66,7 +66,7 @@ class RESTRunner(Runner):
self._server.serve_forever()
def signal_handler(self, signum, frame):
- super(RESTRunner, self).signal_handler(signum, frame)
+ super().signal_handler(signum, frame)
if signum in (signal.SIGTERM, signal.SIGINT, signal.SIGUSR1):
# Set the flag that will terminate the TCPserver loop.
self._event.set()
=====================================
src/mailman/testing/helpers.py
=====================================
--- a/src/mailman/testing/helpers.py
+++ b/src/mailman/testing/helpers.py
@@ -99,7 +99,7 @@ def make_testable_runner(runner_class, name=None,
predicate=None):
"""Stop processing when the queue is empty."""
def __init__(self, *args, **kws):
- super(EmptyingRunner, self).__init__(*args, **kws)
+ super().__init__(*args, **kws)
# We know it's an EmptyingRunner, so really we want to see the
# super class in the log files.
self.__class__.__name__ = runner_class.__name__
@@ -166,8 +166,7 @@ class TestableMaster(Master):
until the pass condition is set.
:type start_check: Callable taking no arguments, returning nothing.
"""
- super(TestableMaster, self).__init__(
- restartable=False, config_file=config.filename)
+ super().__init__(restartable=False, config_file=config.filename)
self.start_check = start_check
self.event = threading.Event()
self.thread = threading.Thread(target=self.loop)
@@ -215,7 +214,7 @@ class TestableMaster(Master):
self.start_check()
# Let the blocking thread know everything's running.
self.event.set()
- super(TestableMaster, self).loop()
+ super().loop()
@property
def runner_pids(self):
View it on GitLab:
https://gitlab.com/mailman/mailman/compare/d063ee4dd4579ca931e36f0761084e4ab7cd0335...802ce668e67f51f904c69fdab2f5565a73c15e8a
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org