[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mailman-cvs
Subject:    [Mailman-checkins] [Branch ~mailman-coders/mailman/3.0] Rev 6697:
From:       noreply () launchpad ! net
Date:       2009-02-23 2:43:08
Message-ID: 20090223024308.12601.26062.launchpad () loganberry ! canonical ! com
[Download RAW message or body]

------------------------------------------------------------
revno: 6697
committer: Barry Warsaw <barry@list.org>
branch nick: hacking
timestamp: Sun 2009-02-22 21:33:17 -0500
message:
  Get rid of one_last_digest.  Move this into a separate OneLastDigest table.
  Make it explicit to get the last digest (I could imagine an user selecting not
  to).  Actually add tests for this.
  
  Start to get rid of 'from storm.locals import *' in favor of more specific
  imports.  Start to use Store.of() instead of config.db.store where we can.
  
  Rework (delivery)MemberRosters to use the Member attributes.  This ensures
  that the layered lookup happens at the expense of query optimization.
  
  Sundry and various cleanups.
added:
  src/mailman/database/digests.py
  src/mailman/interfaces/digests.py
modified:
  src/mailman/database/address.py
  src/mailman/database/mailinglist.py
  src/mailman/database/mailman.sql
  src/mailman/database/roster.py
  src/mailman/docs/addresses.txt
  src/mailman/docs/membership.txt
  src/mailman/interfaces/mailinglist.py
  src/mailman/queue/digest.py
  src/mailman/queue/docs/digester.txt
  src/mailman/styles/default.py

=== modified file 'src/mailman/database/address.py'
--- src/mailman/database/address.py	2009-01-17 02:04:21 +0000
+++ src/mailman/database/address.py	2009-02-23 02:33:17 +0000
@@ -26,10 +26,9 @@
 
 
 from email.utils import formataddr
-from storm.locals import *
+from storm.locals import DateTime, Int, Reference, Store, Unicode
 from zope.interface import implements
 
-from mailman.config import config
 from mailman.database.member import Member
 from mailman.database.model import Model
 from mailman.database.preferences import Preferences
@@ -76,7 +75,8 @@
 
     def subscribe(self, mailing_list, role):
         # This member has no preferences by default.
-        member = config.db.store.find(
+        store = Store.of(self)
+        member = store.find(
             Member,
             Member.role == role,
             Member.mailing_list == mailing_list.fqdn_listname,
@@ -88,7 +88,7 @@
                         mailing_list=mailing_list.fqdn_listname,
                         address=self)
         member.preferences = Preferences()
-        config.db.store.add(member)
+        store.add(member)
         return member
 
     @property

=== added file 'src/mailman/database/digests.py'
--- src/mailman/database/digests.py	1970-01-01 00:00:00 +0000
+++ src/mailman/database/digests.py	2009-02-23 02:33:17 +0000
@@ -0,0 +1,53 @@
+# Copyright (C) 2009 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/>.
+
+"""One last digest."""
+
+from __future__ import absolute_import, unicode_literals
+
+__metaclass__ = type
+__all__ = [
+    'OneLastDigest',
+    ]
+
+
+from storm.locals import Int, Reference
+from zope.interface import implements
+
+from mailman.database.model import Model
+from mailman.database.types import Enum
+from mailman.interfaces.digests import IOneLastDigest
+
+
+
+class OneLastDigest(Model):
+    implements(IOneLastDigest)
+
+    id = Int(primary=True)
+
+    mailing_list_id = Int()
+    mailing_list = Reference(mailing_list_id, 'MailingList.id')
+
+    address_id = Int()
+    address = Reference(address_id, 'Address.id')
+
+    delivery_mode = Enum()
+
+    def __init__(self, mailing_list, address, delivery_mode):
+        self.mailing_list = mailing_list
+        self.address = address
+        self.delivery_mode = delivery_mode

=== modified file 'src/mailman/database/mailinglist.py'
--- src/mailman/database/mailinglist.py	2009-02-20 03:23:42 +0000
+++ src/mailman/database/mailinglist.py	2009-02-23 02:33:17 +0000
@@ -28,12 +28,14 @@
 import os
 import string
 
-from storm.locals import *
+from storm.locals import (
+    Bool, DateTime, Float, Int, Pickle, Store, TimeDelta, Unicode)
 from urlparse import urljoin
 from zope.interface import implements
 
 from mailman.config import config
 from mailman.database import roster
+from mailman.database.digests import OneLastDigest
 from mailman.database.model import Model
 from mailman.database.types import Enum
 from mailman.interfaces.mailinglist import IMailingList, Personalization
@@ -63,7 +65,6 @@
     next_request_id = Int()
     next_digest_number = Int()
     digest_last_sent_at = DateTime()
-    one_last_digest = Pickle()
     volume = Int()
     last_post_time = DateTime()
     # Attributes which are directly modifiable via the web u/i.  The more
@@ -276,3 +277,19 @@
             self._preferred_language = language.code
         except AttributeError:
             self._preferred_language = language
+
+    def send_one_last_digest_to(self, address, delivery_mode):
+        """See `IMailingList`."""
+        digest = OneLastDigest(self, address, delivery_mode)
+        Store.of(self).add(digest)
+
+    @property
+    def last_digest_recipients(self):
+        """See `IMailingList`."""
+        results = Store.of(self).find(
+            OneLastDigest,
+            OneLastDigest.mailing_list == self)
+        recipients = [(digest.address, digest.delivery_mode)
+                      for digest in results]
+        results.remove()
+        return recipients

=== modified file 'src/mailman/database/mailman.sql'
--- src/mailman/database/mailman.sql	2009-02-20 03:23:42 +0000
+++ src/mailman/database/mailman.sql	2009-02-23 02:33:17 +0000
@@ -54,7 +54,6 @@
         next_request_id INTEGER,
         next_digest_number INTEGER,
         digest_last_sent_at TIMESTAMP,
-        one_last_digest BLOB,
         volume INTEGER,
         last_post_time TIMESTAMP,
         accept_these_nonmembers BLOB,
@@ -178,6 +177,17 @@
         message_id TEXT,
         PRIMARY KEY (id)
 );
+CREATE TABLE onelastdigest (
+    id INTEGER NOT NULL,
+    mailing_list_id INTEGER,
+    address_id INTEGER,
+    delivery_mode TEXT,
+    PRIMARY KEY (id),
+    CONSTRAINT onelastdigest_mailing_list_id_fk
+        FOREIGN KEY(mailing_list_id) REFERENCES mailinglist(id),
+    CONSTRAINT onelastdigest_address_id_fk
+        FOREIGN KEY(address_id) REFERENCES address(id)
+    );
 CREATE TABLE pended (
         id INTEGER NOT NULL,
         token TEXT,

=== modified file 'src/mailman/database/roster.py'
--- src/mailman/database/roster.py	2009-01-17 02:04:21 +0000
+++ src/mailman/database/roster.py	2009-02-23 02:33:17 +0000
@@ -37,12 +37,13 @@
     ]
 
 
-from storm.locals import *
+from storm.expr import And, LeftJoin, Or
 from zope.interface import implements
 
 from mailman.config import config
 from mailman.database.address import Address
 from mailman.database.member import Member
+from mailman.database.preferences import Preferences
 from mailman.interfaces.member import DeliveryMode, MemberRole
 from mailman.interfaces.roster import IRoster
 
@@ -167,49 +168,49 @@
 
 
 
-class RegularMemberRoster(AbstractRoster):
+class DeliveryMemberRoster(AbstractRoster):
+    """Return all the members having a particular kind of delivery."""
+
+    def _get_members(self, *delivery_modes):
+        """The set of members for a mailing list, filter by delivery mode.
+
+        :param delivery_modes: The modes to filter on.
+        :type delivery_modes: sequence of `DeliveryMode`.
+        :return: A generator of members.
+        :rtype: generator
+        """
+        results = config.db.store.find(
+            Member,
+            And(Member.mailing_list == self._mlist.fqdn_listname,
+                Member.role == MemberRole.member))
+        for member in results:
+            if member.delivery_mode in delivery_modes:
+                yield member
+
+
+class RegularMemberRoster(DeliveryMemberRoster):
     """Return all the regular delivery members of a list."""
 
     name = 'regular_members'
 
     @property
     def members(self):
-        # Query for all the Members which have a role of MemberRole.member and
-        # are subscribed to this mailing list.  Then return only those members
-        # that have a regular delivery mode.
-        for member in config.db.store.find(
-                Member,
-                mailing_list=self._mlist.fqdn_listname,
-                role=MemberRole.member):
-            if member.delivery_mode == DeliveryMode.regular:
-                yield member
+        for member in self._get_members(DeliveryMode.regular):
+            yield member
 
 
 
-_digest_modes = (
-    DeliveryMode.mime_digests,
-    DeliveryMode.plaintext_digests,
-    DeliveryMode.summary_digests,
-    )
-
-
-
-class DigestMemberRoster(AbstractRoster):
+class DigestMemberRoster(DeliveryMemberRoster):
     """Return all the regular delivery members of a list."""
 
     name = 'digest_members'
 
     @property
     def members(self):
-        # Query for all the Members which have a role of MemberRole.member and
-        # are subscribed to this mailing list.  Then return only those members
-        # that have one of the digest delivery modes.
-        for member in config.db.store.find(
-                Member,
-                mailing_list=self._mlist.fqdn_listname,
-                role=MemberRole.member):
-            if member.delivery_mode in _digest_modes:
-                yield member
+        for member in self._get_members(DeliveryMode.plaintext_digests,
+                                        DeliveryMode.mime_digests,
+                                        DeliveryMode.summary_digests):
+            yield member
 
 
 

=== modified file 'src/mailman/docs/addresses.txt'
--- src/mailman/docs/addresses.txt	2009-01-04 05:22:08 +0000
+++ src/mailman/docs/addresses.txt	2009-02-23 02:33:17 +0000
@@ -148,7 +148,8 @@
 
     >>> address_5 = usermgr.create_address(
     ...     u'eperson@example.com', u'Elly Person')
-    >>> mlist = config.db.list_manager.create(u'_xtext@example.com')
+    >>> mlist = create_list(u'_xtext@example.com')
+
     >>> from mailman.interfaces.member import MemberRole
     >>> address_5.subscribe(mlist, MemberRole.owner)
     <Member: Elly Person <eperson@example.com> on

=== modified file 'src/mailman/docs/membership.txt'
--- src/mailman/docs/membership.txt	2009-01-04 05:22:08 +0000
+++ src/mailman/docs/membership.txt	2009-02-23 02:33:17 +0000
@@ -2,7 +2,7 @@
 ================
 
 Users represent people in Mailman.  Users control email addresses, and rosters
-are collectons of members.  A member gives an email address a role, such as
+are collections of members.  A member gives an email address a role, such as
 'member', 'administrator', or 'moderator'.  Roster sets are collections of
 rosters and a mailing list has a single roster set that contains all its
 members, regardless of that member's role.

=== added file 'src/mailman/interfaces/digests.py'
--- src/mailman/interfaces/digests.py	1970-01-01 00:00:00 +0000
+++ src/mailman/interfaces/digests.py	2009-02-23 02:33:17 +0000
@@ -0,0 +1,42 @@
+# Copyright (C) 2009 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/>.
+
+"""One last digest."""
+
+from __future__ import absolute_import, unicode_literals
+
+__metaclass__ = type
+__all__ = [
+    'IOneLastDigest'
+    ]
+
+
+from zope.interface import Interface, Attribute
+
+
+
+class IOneLastDigest(Interface):
+    """Users who should receive one last digest."""
+
+    mailing_list = Attribute(
+        """The mailing list for the one last digest.""")
+
+    address = Attribute(
+        """The address to receive the one last digest.""")
+
+    delivery_mode = Attribute(
+        """The digest delivery mode to send.""")

=== modified file 'src/mailman/interfaces/mailinglist.py'
--- src/mailman/interfaces/mailinglist.py	2009-02-04 12:00:56 +0000
+++ src/mailman/interfaces/mailinglist.py	2009-02-23 02:33:17 +0000
@@ -216,26 +216,31 @@
         the digest volume number is bumped, the digest number is reset to
         1.""")
 
-    message_count = Attribute(
-        """The number of messages in the digest currently being collected.""")
-
     digest_size_threshold = Attribute(
         """The maximum (approximate) size in kilobytes of the digest currently
         being collected.""")
 
-    messages = Attribute(
-        """An iterator over all the messages in the digest currently being
-        created.  Returns individual IPostedMessage objects.
+    def send_one_last_digest_to(address, delivery_mode):
+        """Make sure to send one last digest to an address.
+
+        This is used when a person transitions from digest delivery to regular
+        delivery and wants to make sure they don't miss anything.  By
+        indicating that they'd like to receive one last digest, they will
+        ensure continuity in receiving mailing lists posts.
+
+        :param address: The address of the person receiving one last digest.
+        :type address: `IAddress`
+        :param delivery_mode: The type of digest to receive.
+        :type delivery_mode: `DeliveryMode`
+        """
+
+    last_digest_recipients = Attribute(
+        """An iterator over the addresses that should receive one last digest.
+
+        Items are 2-tuples of (`IAddress`, `DeliveryMode`).  The one last
+        digest recipients are cleared.
         """)
 
-    limits = Attribute(
-        """An iterator over the IDigestLimiters associated with this digest.
-        Each limiter can make a determination of whether the digest has
-        reached the threshold for being automatically sent.""")
-
-    def send():
-        """Send this digest now."""
-
     decorators = Attribute(
         """An iterator over all the IDecorators associated with this digest.
         When a digest is being sent, each decorator may modify the final

=== modified file 'src/mailman/queue/digest.py'
--- src/mailman/queue/digest.py	2009-02-13 01:36:21 +0000
+++ src/mailman/queue/digest.py	2009-02-23 02:33:17 +0000
@@ -43,6 +43,7 @@
 from mailman.config import config
 from mailman.core.errors import DiscardMessage
 from mailman.i18n import _
+from mailman.interfaces.member import DeliveryMode, DeliveryStatus
 from mailman.pipeline.decorate import decorate
 from mailman.pipeline.scrubber import process as scrubber
 from mailman.queue import Runner
@@ -332,10 +333,6 @@
         # digest to ensure that there will be no gaps in the messages they
         # receive.
         digest_members = set(mlist.digest_members.members)
-        for address in mlist.one_last_digest:
-            member = mlist.digest_members.get_member(address)
-            if member:
-                digest_members.add(member)
         for member in digest_members:
             if member.delivery_status <> DeliveryStatus.enabled:
                 continue
@@ -350,6 +347,16 @@
                 raise AssertionError(
                     'Digest member "{0}" unexpected delivery mode: {1}'.format(
                         email_address, member.delivery_mode))
+        # Add also the folks who are receiving one last digest.
+        for address, delivery_mode in mlist.last_digest_recipients:
+            if delivery_mode == DeliveryMode.plaintext_digests:
+                rfc1153_recipients.add(address.original_address)
+            elif delivery_mode == DeliveryMode.mime_digests:
+                mime_recipients.add(address.original_address)
+            else:
+                raise AssertionError(
+                    'OLD recipient "{0}" unexpected delivery mode: {1}'.format(
+                        address, delivery_mode))
         # Send the digests to the virgin queue for final delivery.
         queue = config.switchboards['virgin']
         queue.enqueue(mime,
@@ -360,6 +367,3 @@
                       recips=rfc1153_recipients,
                       listname=mlist.fqdn_listname,
                       isdigest=True)
-        # Now that we've delivered the last digest to folks who were waiting
-        # for it, clear that recipient set.
-        mlist.one_last_digest.clear()

=== modified file 'src/mailman/queue/docs/digester.txt'
--- src/mailman/queue/docs/digester.txt	2009-02-11 00:42:34 +0000
+++ src/mailman/queue/docs/digester.txt	2009-02-23 02:33:17 +0000
@@ -8,23 +8,27 @@
     >>> mlist.digest_size_threshold = 0.5
     >>> mlist.volume = 1
     >>> mlist.next_digest_number = 1
-    >>> size = 0
 
     >>> from string import Template
     >>> process = config.handlers['to-digest'].process
-    >>> for i in range(1, 5):
-    ...     text = Template("""\
+
+    >>> def fill_digest():
+    ...     size = 0
+    ...     for i in range(1, 5):
+    ...         text = Template("""\
     ... From: aperson@example.com
     ... To: xtest@example.com
     ... Subject: Test message $i
     ...
     ... Here is message $i
     ... """).substitute(i=i)
-    ...     msg = message_from_string(text)
-    ...     process(mlist, msg, {})
-    ...     size += len(text)
-    ...     if size >= mlist.digest_size_threshold * 1024:
-    ...         break
+    ...         msg = message_from_string(text)
+    ...         process(mlist, msg, {})
+    ...         size += len(text)
+    ...         if size >= mlist.digest_size_threshold * 1024:
+    ...             break
+
+    >>> fill_digest()
 
 The queue runner gets kicked off when a marker message gets dropped into the
 digest queue.  The message metadata points to the mailbox file containing the
@@ -77,16 +81,16 @@
 
 The MIME digest is a multipart, and the RFC 1153 digest is the other one.
 
-    >>> if messages[0].msg.is_multipart():
-    ...     mime = messages[0].msg
-    ...     rfc1153 = messages[1].msg
-    ... else:
-    ...     mime = messages[1].msg
-    ...     rfc1153 = messages[0].msg
+    >>> def mime_rfc1153(messages):
+    ...     if messages[0].msg.is_multipart():
+    ...         return messages[0], messages[1]
+    ...     return messages[1], messages[0]
+
+    >>> mime, rfc1153 = mime_rfc1153(messages)
 
 The MIME digest has lots of good stuff, all contained in the multipart.
 
-    >>> print mime.as_string()
+    >>> print mime.msg.as_string()
     Content-Type: multipart/mixed; boundary="===============...=="
     MIME-Version: 1.0
     From: test-request@example.com
@@ -103,15 +107,15 @@
     Content-Description: Test Digest, Vol 1, Issue 1
     <BLANKLINE>
     Send Test mailing list submissions to
-    	test@example.com
+        test@example.com
     <BLANKLINE>
     To subscribe or unsubscribe via the World Wide Web, visit
-    	http://lists.example.com/listinfo/test@example.com
+        http://lists.example.com/listinfo/test@example.com
     or, via email, send a message with subject or body 'help' to
-    	test-request@example.com
+        test-request@example.com
     <BLANKLINE>
     You can reach the person managing the list at
-    	test-owner@example.com
+        test-owner@example.com
     <BLANKLINE>
     When replying, please edit your Subject line so it is more specific
     than "Re: Contents of Test digest..."
@@ -184,7 +188,7 @@
 
 The RFC 1153 contains the digest in a single plain text message.
 
-    >>> print rfc1153.as_string()
+    >>> print rfc1153.msg.as_string()
     From: test-request@example.com
     Subject: Test Digest, Vol 1, Issue 1
     To: test@example.com
@@ -196,15 +200,15 @@
     Content-Transfer-Encoding: 7bit
     <BLANKLINE>
     Send Test mailing list submissions to
-    	test@example.com
+        test@example.com
     <BLANKLINE>
     To subscribe or unsubscribe via the World Wide Web, visit
-    	http://lists.example.com/listinfo/test@example.com
+        http://lists.example.com/listinfo/test@example.com
     or, via email, send a message with subject or body 'help' to
-    	test-request@example.com
+        test-request@example.com
     <BLANKLINE>
     You can reach the person managing the list at
-    	test-owner@example.com
+        test-owner@example.com
     <BLANKLINE>
     When replying, please edit your Subject line so it is more specific
     than "Re: Contents of Test digest..."
@@ -324,16 +328,11 @@
 
 One of which is the MIME digest and the other of which is the RFC 1153 digest.
 
-    >>> if messages[0].msg.is_multipart():
-    ...     mime = messages[0].msg
-    ...     rfc1153 = messages[1].msg
-    ... else:
-    ...     mime = messages[1].msg
-    ...     rfc1153 = messages[0].msg
+    >>> mime, rfc1153 = mime_rfc1153(messages)
 
 You can see that the digests contain a mix of French and Japanese.
 
-    >>> print mime.as_string()
+    >>> print mime.msg.as_string()
     Content-Type: multipart/mixed; boundary="===============...=="
     MIME-Version: 1.0
     From: test-request@example.com
@@ -350,17 +349,17 @@
     Content-Description: Groupe Test, Vol. 1, Parution 2
     <BLANKLINE>
     Envoyez vos messages pour la liste Test =E0
-    	test@example.com
+        test@example.com
     <BLANKLINE>
     Pour vous (d=E9s)abonner par le web, consultez
-    	http://lists.example.com/listinfo/test@example.com
+        http://lists.example.com/listinfo/test@example.com
     <BLANKLINE>
     ou, par courriel, envoyez un message avec =AB=A0help=A0=BB dans le corps ou
     dans le sujet =E0
-    	test-request@example.com
+        test-request@example.com
     <BLANKLINE>
     Vous pouvez contacter l'administrateur de la liste =E0 l'adresse
-    	test-owner@example.com
+        test-owner@example.com
     <BLANKLINE>
     Si vous r=E9pondez, n'oubliez pas de changer l'objet du message afin
     qu'il soit plus sp=E9cifique que =AB=A0Re: Contenu du groupe de Test...=A0=
@@ -402,7 +401,7 @@
 The RFC 1153 digest will be encoded in UTF-8 since it contains a mixture of
 French and Japanese characters.
 
-    >>> print rfc1153.as_string()
+    >>> print rfc1153.msg.as_string()
     From: test-request@example.com
     Subject: Groupe Test, Vol. 1, Parution 2
     To: test@example.com
@@ -420,7 +419,8 @@
 
     # We must display the repr of the decoded value because doctests cannot
     # handle the non-ascii characters.
-    >>> [repr(line) for line in rfc1153.get_payload(decode=True).splitlines()]
+    >>> [repr(line)
+    ...  for line in rfc1153.msg.get_payload(decode=True).splitlines()]
     ["'Envoyez vos messages pour la liste Test \\xc3\\xa0'",
      "'\\ttest@example.com'",
      "''",
@@ -462,3 +462,124 @@
      "''",
      "'Fin de Groupe Test, Vol. 1, Parution 2'",
      "'**************************************'"]
+
+     >>> config.pop('french')
+
+
+Digest delivery
+---------------
+
+A mailing list's members can choose to receive normal delivery, plain text
+digests, or MIME digests.
+
+    >>> len(get_queue_messages('virgin'))
+    0
+
+    >>> from mailman.interfaces.member import DeliveryMode, MemberRole
+    >>> def subscribe(email, mode):
+    ...     address = config.db.user_manager.create_address(email)
+    ...     member = address.subscribe(mlist, MemberRole.member)
+    ...     member.preferences.delivery_mode = mode
+    ...     return member
+
+Two regular delivery members subscribe to the mailing list.
+
+    >>> member_1 = subscribe(u'uperson@example.com', DeliveryMode.regular)
+    >>> member_2 = subscribe(u'vperson@example.com', DeliveryMode.regular)
+
+Two MIME digest members subscribe to the mailing list.
+
+    >>> member_3 = subscribe(u'wperson@example.com', DeliveryMode.mime_digests)
+    >>> member_4 = subscribe(u'xperson@example.com', DeliveryMode.mime_digests)
+
+One RFC 1153 digest member subscribes to the mailing list.
+
+    >>> member_5 = subscribe(
+    ...     u'yperson@example.com', DeliveryMode.plaintext_digests)
+    >>> member_6 = subscribe(
+    ...     u'zperson@example.com', DeliveryMode.plaintext_digests)
+
+When a digest gets sent, the appropriate recipient list is chosen.
+
+    >>> mlist.preferred_language = u'en'
+    >>> mlist.digest_size_threshold = 0.5
+    >>> fill_digest()
+    >>> runner.run()
+
+The digests are sitting in the virgin queue.  One of them is the MIME digest
+and the other is the RFC 1153 digest.
+
+    >>> messages = get_queue_messages('virgin')
+    >>> len(messages)
+    2
+
+    >>> mime, rfc1153 = mime_rfc1153(messages)
+
+Only wperson and xperson get the MIME digests.
+
+    >>> sorted(mime.msgdata['recips'])
+    [u'wperson@example.com', u'xperson@example.com']
+
+Only yperson and zperson get the RFC 1153 digests.
+
+    >>> sorted(rfc1153.msgdata['recips'])
+    [u'yperson@example.com', u'zperson@example.com']
+
+Now uperson decides that they would like to start receiving digests too.
+
+    >>> member_1.preferences.delivery_mode = DeliveryMode.mime_digests
+    >>> fill_digest()
+    >>> runner.run()
+
+    >>> messages = get_queue_messages('virgin')
+    >>> len(messages)
+    2
+
+    >>> mime, rfc1153 = mime_rfc1153(messages)
+    >>> sorted(mime.msgdata['recips'])
+    [u'uperson@example.com', u'wperson@example.com', u'xperson@example.com']
+
+    >>> sorted(rfc1153.msgdata['recips'])
+    [u'yperson@example.com', u'zperson@example.com']
+
+At this point, both uperson and wperson decide that they'd rather receive
+regular deliveries instead of digests.  uperson would like to get any last
+digest that may be sent so that she doesn't miss anything.  wperson does care
+as much and does not want to receive one last digest.
+
+    >>> mlist.send_one_last_digest_to(
+    ...     member_1.address, member_1.preferences.delivery_mode)
+
+    >>> member_1.preferences.delivery_mode = DeliveryMode.regular
+    >>> member_3.preferences.delivery_mode = DeliveryMode.regular
+
+    >>> fill_digest()
+    >>> runner.run()
+
+    >>> messages = get_queue_messages('virgin')
+    >>> len(messages)
+    2
+
+    >>> mime, rfc1153 = mime_rfc1153(messages)
+    >>> sorted(mime.msgdata['recips'])
+    [u'uperson@example.com', u'xperson@example.com']
+
+    >>> sorted(rfc1153.msgdata['recips'])
+    [u'yperson@example.com', u'zperson@example.com']
+
+Since uperson has received their last digest, they will not get any more of
+them.
+
+    >>> fill_digest()
+    >>> runner.run()
+
+    >>> messages = get_queue_messages('virgin')
+    >>> len(messages)
+    2
+
+    >>> mime, rfc1153 = mime_rfc1153(messages)
+    >>> sorted(mime.msgdata['recips'])
+    [u'xperson@example.com']
+
+    >>> sorted(rfc1153.msgdata['recips'])
+    [u'yperson@example.com', u'zperson@example.com']

=== modified file 'src/mailman/styles/default.py'
--- src/mailman/styles/default.py	2009-02-20 03:23:42 +0000
+++ src/mailman/styles/default.py	2009-02-23 02:33:17 +0000
@@ -123,7 +123,6 @@
 ${listinfo_page}
 """
         mlist.digest_volume_frequency = DigestFrequency.monthly
-        mlist.one_last_digest = {}
         mlist.next_digest_number = 1
         mlist.nondigestable = True
         mlist.personalize = Personalization.none



--
Primary development focus
https://code.launchpad.net/~mailman-coders/mailman/3.0

Your team Mailman Checkins is subscribed to branch lp:mailman.
To unsubscribe from this branch go to \
https://code.launchpad.net/~mailman-coders/mailman/3.0/+edit-subscription. \
_______________________________________________ Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: http://mail.python.org/mailman/options/mailman-checkins/mailman-cvs%40progressive-comp.com



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic