~barry/mailman/lp1423756

« back to all changes in this revision

Viewing changes to src/mailman/handlers/to_digest.py

  • Committer: Barry Warsaw
  • Date: 2015-01-05 01:20:33 UTC
  • mfrom: (7264.4.66 py3)
  • Revision ID: barry@list.org-20150105012033-zdrw9c2odhpf22fz
Merge the Python 3 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Add the message to the list's current digest."""
19
19
 
20
 
from __future__ import absolute_import, print_function, unicode_literals
21
 
 
22
 
__metaclass__ = type
23
20
__all__ = [
24
21
    'ToDigest',
25
22
    ]
27
24
 
28
25
import os
29
26
 
30
 
from zope.interface import implementer
31
 
 
32
27
from mailman.config import config
33
28
from mailman.core.i18n import _
34
29
from mailman.email.message import Message
36
31
from mailman.interfaces.handler import IHandler
37
32
from mailman.utilities.datetime import now as right_now
38
33
from mailman.utilities.mailbox import Mailbox
 
34
from zope.interface import implementer
39
35
 
40
36
 
41
37
 
55
51
        mailbox_path = os.path.join(mlist.data_path, 'digest.mmdf')
56
52
        # Lock the mailbox and append the message.
57
53
        with Mailbox(mailbox_path, create=True) as mbox:
58
 
            mbox.add(msg.as_string())
 
54
            mbox.add(msg)
59
55
        # Calculate the current size of the mailbox file.  This will not tell
60
56
        # us exactly how big the resulting MIME and rfc1153 digest will
61
57
        # actually be, but it's the most easily available metric to decide
75
71
            os.rename(mailbox_path, mailbox_dest)
76
72
            config.switchboards['digest'].enqueue(
77
73
                Message(),
78
 
                listname=mlist.fqdn_listname,
 
74
                listid=mlist.list_id,
79
75
                digest_path=mailbox_dest,
80
76
                volume=volume,
81
77
                digest_number=digest_number)