summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortkikuchi2007-03-02 12:36:15 +0000
committertkikuchi2007-03-02 12:36:15 +0000
commita39a27fce459fb6fc4d0c1ee17ab571d51bf16bf (patch)
tree97824a5764d9924e283ba0c2c94e39bc6cd0a3b1
parent173997db20a1fad4ec6a78e0c7a88e147869cd7d (diff)
downloadmailman-a39a27fce459fb6fc4d0c1ee17ab571d51bf16bf.tar.gz
mailman-a39a27fce459fb6fc4d0c1ee17ab571d51bf16bf.tar.zst
mailman-a39a27fce459fb6fc4d0c1ee17ab571d51bf16bf.zip
-rw-r--r--Mailman/Digester.py1
-rw-r--r--Mailman/Handlers/ToDigest.py23
-rw-r--r--Mailman/Queue/Switchboard.py2
-rw-r--r--Mailman/Utils.py7
-rw-r--r--Mailman/bin/senddigests.py3
-rw-r--r--Mailman/database/listdata.py10
6 files changed, 32 insertions, 14 deletions
diff --git a/Mailman/Digester.py b/Mailman/Digester.py
index 2fb8c5e74..d2051c86f 100644
--- a/Mailman/Digester.py
+++ b/Mailman/Digester.py
@@ -37,7 +37,6 @@ class Digester:
self.mime_is_default_digest = config.DEFAULT_MIME_IS_DEFAULT_DIGEST
self.digest_size_threshhold = config.DEFAULT_DIGEST_SIZE_THRESHHOLD
self.digest_send_periodic = config.DEFAULT_DIGEST_SEND_PERIODIC
- self.next_post_number = 1
self.digest_header = config.DEFAULT_DIGEST_HEADER
self.digest_footer = config.DEFAULT_DIGEST_FOOTER
self.digest_volume_frequency = config.DEFAULT_DIGEST_VOLUME_FREQUENCY
diff --git a/Mailman/Handlers/ToDigest.py b/Mailman/Handlers/ToDigest.py
index 471886afc..3b22c6cee 100644
--- a/Mailman/Handlers/ToDigest.py
+++ b/Mailman/Handlers/ToDigest.py
@@ -31,7 +31,7 @@ import copy
import time
import logging
-from cStringIO import StringIO
+from StringIO import StringIO
from email.Charset import Charset
from email.Generator import Generator
from email.Header import decode_header, make_header, Header
@@ -162,6 +162,8 @@ def send_i18n_digests(mlist, mboxfp):
mimemsg['Message-ID'] = Utils.unique_message_id(mlist)
# Set things up for the rfc1153 digest
plainmsg = StringIO()
+ # cStringIO doesn't have encoding. Sigh.
+ plainmsg.encoding = 'utf-8'
rfc1153msg = Message.Message()
rfc1153msg['From'] = mlist.GetRequestEmail()
rfc1153msg['Subject'] = digestsubj
@@ -184,7 +186,7 @@ def send_i18n_digests(mlist, mboxfp):
'got_owner_email': mlist.GetOwnerEmail(),
}, mlist=mlist)
# MIME
- masthead = MIMEText(mastheadtxt, _charset=lcset)
+ masthead = MIMEText(mastheadtxt.encode(lcset), _charset=lcset)
masthead['Content-Description'] = digestid
mimemsg.attach(masthead)
# RFC 1153
@@ -194,7 +196,7 @@ def send_i18n_digests(mlist, mboxfp):
if mlist.digest_header:
headertxt = decorate(mlist, mlist.digest_header, _('digest header'))
# MIME
- header = MIMEText(headertxt, _charset=lcset)
+ header = MIMEText(headertxt.encode(lcset), _charset=lcset)
header['Content-Description'] = _('Digest Header')
mimemsg.attach(header)
# RFC 1153
@@ -208,6 +210,7 @@ def send_i18n_digests(mlist, mboxfp):
#
# Meanwhile prepare things for the table of contents
toc = StringIO()
+ toc.encoding = 'utf-8'
print >> toc, _("Today's Topics:\n")
# Now cruise through all the messages in the mailbox of digest messages,
# building the MIME payload and core of the RFC 1153 digest. We'll also
@@ -224,14 +227,15 @@ def send_i18n_digests(mlist, mboxfp):
messages.append(msg)
# Get the Subject header
msgsubj = msg.get('subject', _('(no subject)'))
- subject = Utils.oneline(msgsubj, lcset)
+ subject = Utils.oneline(msgsubj, in_unicode=True)
# Don't include the redundant subject prefix in the toc
mo = re.match('(re:? *)?(%s)' % re.escape(mlist.subject_prefix),
subject, re.IGNORECASE)
if mo:
subject = subject[:mo.start(2)] + subject[mo.end(2):]
username = ''
- addresses = getaddresses([Utils.oneline(msg.get('from', ''), lcset)])
+ addresses = getaddresses([Utils.oneline(msg.get('from', ''),
+ in_unicode=True)])
# Take only the first author we find
if isinstance(addresses, list) and addresses:
username = addresses[0][0]
@@ -287,7 +291,7 @@ def send_i18n_digests(mlist, mboxfp):
return
toctext = toc.getvalue()
# MIME
- tocpart = MIMEText(toctext, _charset=lcset)
+ tocpart = MIMEText(toctext.encode(lcset), _charset=lcset)
tocpart['Content-Description']= _("Today's Topics (%(msgcount)d messages)")
mimemsg.attach(tocpart)
# RFC 1153
@@ -319,7 +323,8 @@ def send_i18n_digests(mlist, mboxfp):
# Honor the default setting
for h in config.PLAIN_DIGEST_KEEP_HEADERS:
if msg[h]:
- uh = Utils.wrap('%s: %s' % (h, Utils.oneline(msg[h], lcset)))
+ uh = Utils.wrap('%s: %s' % (h, Utils.oneline(msg[h],
+ in_unicode=True)))
uh = '\n\t'.join(uh.split('\n'))
print >> plainmsg, uh
print >> plainmsg
@@ -344,7 +349,7 @@ def send_i18n_digests(mlist, mboxfp):
if mlist.digest_footer:
footertxt = decorate(mlist, mlist.digest_footer, _('digest footer'))
# MIME
- footer = MIMEText(footertxt, _charset=lcset)
+ footer = MIMEText(footertxt.encode(lcset), _charset=lcset)
footer['Content-Description'] = _('Digest Footer')
mimemsg.attach(footer)
# RFC 1153
@@ -397,7 +402,7 @@ def send_i18n_digests(mlist, mboxfp):
listname=mlist.fqdn_listname,
isdigest=True)
# RFC 1153
- rfc1153msg.set_payload(plainmsg.getvalue(), lcset)
+ rfc1153msg.set_payload(plainmsg.getvalue().encode(lcset), lcset)
virginq.enqueue(rfc1153msg,
recips=plainrecips,
listname=mlist.fqdn_listname,
diff --git a/Mailman/Queue/Switchboard.py b/Mailman/Queue/Switchboard.py
index faf0988e1..43d121f6f 100644
--- a/Mailman/Queue/Switchboard.py
+++ b/Mailman/Queue/Switchboard.py
@@ -94,7 +94,7 @@ class Switchboard:
else:
protocol = 0
msgsave = cPickle.dumps(str(_msg), protocol)
- hashfood = msgsave + listname + `now`
+ hashfood = msgsave + str(listname) + `now`
# Encode the current time into the file name for FIFO sorting in
# files(). The file name consists of two parts separated by a `+':
# the received time for this message (i.e. when it first showed up on
diff --git a/Mailman/Utils.py b/Mailman/Utils.py
index 5844d708c..958a3e959 100644
--- a/Mailman/Utils.py
+++ b/Mailman/Utils.py
@@ -826,13 +826,16 @@ def uquote(s):
return str(EMPTYSTRING.join(a))
-def oneline(s, cset):
+def oneline(s, cset='us-ascii', in_unicode=False):
# Decode header string in one line and convert into specified charset
try:
h = email.Header.make_header(email.Header.decode_header(s))
ustr = h.__unicode__()
line = UEMPTYSTRING.join(ustr.splitlines())
- return line.encode(cset, 'replace')
+ if in_unicode:
+ return line
+ else:
+ return line.encode(cset, 'replace')
except (LookupError, UnicodeError, ValueError, HeaderParseError):
# possibly charset problem. return with undecoded string in one line.
return EMPTYSTRING.join(s.splitlines())
diff --git a/Mailman/bin/senddigests.py b/Mailman/bin/senddigests.py
index 3c18a6991..9fc5fad0c 100644
--- a/Mailman/bin/senddigests.py
+++ b/Mailman/bin/senddigests.py
@@ -23,6 +23,7 @@ from Mailman import Utils
from Mailman import Version
from Mailman.configuration import config
from Mailman.i18n import _
+from Mailman.initialize import initialize
# Work around known problems with some RedHat cron daemons
import signal
@@ -57,7 +58,7 @@ lists are sent out. Multiple -l options may be given."""))
def main():
opts, args, parser = parseargs()
- config.load(opts.config)
+ initialize(opts.config)
for listname in set(opts.listnames or Utils.list_names()):
mlist = MailList.MailList(listname, lock=False)
diff --git a/Mailman/database/listdata.py b/Mailman/database/listdata.py
index be361d586..92a2d070a 100644
--- a/Mailman/database/listdata.py
+++ b/Mailman/database/listdata.py
@@ -29,6 +29,15 @@ def make_table(metadata, tables):
Column('list_name', Unicode),
Column('web_page_url', Unicode),
Column('admin_member_chunksize', Integer),
+ Column('next_request_id', Integer),
+ Column('next_digest_number', Integer),
+ Column('admin_responses', PickleType),
+ Column('postings_responses', PickleType),
+ Column('request_responses', PickleType),
+ Column('digest_last_sent_at', Float),
+ Column('one_last_digest', PickleType),
+ Column('volume', Integer),
+ Column('last_post_time', Float),
# OldStyleMemberships attributes, temporarily stored as pickles.
Column('bounce_info', PickleType),
Column('delivery_status', PickleType),
@@ -106,6 +115,7 @@ def make_table(metadata, tables):
Column('member_moderation_action', Boolean),
Column('member_moderation_notice', Unicode),
Column('mime_is_default_digest', Boolean),
+ Column('mod_password', Unicode),
Column('moderator', PickleType),
Column('msg_footer', Unicode),
Column('msg_header', Unicode),