Update of /cvsroot/mailman/mailman/cron
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9769
Modified Files:
checkdbs disabled mailpasswds
Log Message:
back porting from 2.1.6
Index: checkdbs
===================================================================
RCS file: /cvsroot/mailman/mailman/cron/checkdbs,v
retrieving revision 2.20
retrieving revision 2.21
diff -u -d -r2.20 -r2.21
--- checkdbs 27 Aug 2005 01:54:03 -0000 2.20
+++ checkdbs 28 Aug 2005 05:47:08 -0000 2.21
@@ -52,6 +52,8 @@
_ = i18n._
i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
+now = time.time()
+
def usage(code, msg=''):
@@ -99,16 +101,27 @@
if count:
i18n.set_language(mlist.preferred_language)
realname = mlist.real_name
- text = Utils.maketext(
- 'checkdbs.txt',
- {'count' : count,
- 'host_name': mlist.host_name,
- 'adminDB' : mlist.GetScriptURL('admindb', absolute=1),
- 'real_name': realname,
- }, mlist=mlist)
- text += '\n' + pending_requests(mlist)
- subject = _(
- '%(count)d %(realname)s moderator request(s) waiting')
+ discarded = auto_discard(mlist)
+ if discarded:
+ count = count - discarded
+ text = _(
+ 'Notice: %(discarded)d old request(s) automatically expired.\n\n')
+ else:
+ text = ''
+ if count:
+ text += Utils.maketext(
+ 'checkdbs.txt',
+ {'count' : count,
+ 'host_name': mlist.host_name,
+ 'adminDB' : mlist.GetScriptURL('admindb',
absolute=1),
+ 'real_name': realname,
+ }, mlist=mlist)
+ text += '\n' + pending_requests(mlist)
+ subject = _(
+ '%(count)d %(realname)s moderator request(s) waiting')
+ else:
+ subject = _(
+ '%(realname)s moderator request check result')
msg = Message.UserNotification(mlist.GetOwnerEmail(),
mlist.GetBouncesEmail(),
subject, text,
@@ -122,6 +135,7 @@
def pending_requests(mlist):
# Must return a byte string
+ lcset = Utils.GetCharSet(mlist.preferred_language)
pending = []
first = 1
for id in mlist.GetSubscriptionIds():
@@ -130,6 +144,8 @@
first = 0
when, addr, fullname, passwd, digest, lang = mlist.GetRecord(id)
if fullname:
+ if isinstance(fullname, UnicodeType):
+ fullname = fullname.encode(lcset, 'replace')
fullname = ' (%s)' % fullname
pending.append(' %s%s %s' % (addr, fullname, time.ctime(when)))
first = 1
@@ -139,6 +155,7 @@
first = 0
info = mlist.GetRecord(id)
when, sender, subject, reason, text, msgdata = mlist.GetRecord(id)
+ subject = Utils.oneline(subject, lcset)
date = time.ctime(when)
reason = _(reason)
pending.append(_("""\
@@ -168,6 +185,18 @@
utext = unicode(text, incodec, 'replace')
return utext.encode(outcodec, 'replace')
+def auto_discard(mlist):
+ # Discard old held messages
+ discard_count = 0
+ expire = mlist.max_days_to_hold * 86400 # days
+ heldmsgs = mlist.GetHeldMessageIds()
+ if expire and len(heldmsgs):
+ for id in heldmsgs:
+ if now - mlist.GetRecord(id)[0] > expire:
+ mlist.HandleRequest(id, mm_cfg.DISCARD)
+ discard_count += 1
+ mlist.Save()
+ return discard_count
if __name__ == '__main__':
Index: disabled
===================================================================
RCS file: /cvsroot/mailman/mailman/cron/disabled,v
retrieving revision 2.10
retrieving revision 2.11
diff -u -d -r2.10 -r2.11
--- disabled 27 Aug 2005 01:54:03 -0000 2.10
+++ disabled 28 Aug 2005 05:47:08 -0000 2.11
@@ -1,6 +1,6 @@
#! @PYTHON@
#
-# Copyright (C) 2001-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2004 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -189,8 +189,9 @@
info = _BounceInfo(
member, 0, today,
mlist.bounce_you_are_disabled_warnings,
- Pending.new(Pending.RE_ENABLE, mlist.internal_name(),
- member))
+ mlist.pend_new(Pending.RE_ENABLE,
+ mlist.internal_name(),
+ member))
mlist.setBounceInfo(member, info)
lastnotice = time.mktime(info.lastnotice + (0,) * 6)
if force or today >= lastnotice + interval:
Index: mailpasswds
===================================================================
RCS file: /cvsroot/mailman/mailman/cron/mailpasswds,v
retrieving revision 2.18
retrieving revision 2.19
diff -u -d -r2.18 -r2.19
--- mailpasswds 27 Aug 2005 01:54:03 -0000 2.18
+++ mailpasswds 28 Aug 2005 05:47:08 -0000 2.19
@@ -193,9 +193,6 @@
poplang = lang
langcnt = cnt
enc = Utils.GetCharSet(poplang)
- # Craft the table header
- header = '%-40s %-10s\n%-40s %-10s' % (
- _('List'), _('Password // URL'), '----', '--------')
# Now we're finally ready to send the email!
siteowner = Utils.get_site_email(host, 'owner')
sitereq = Utils.get_site_email(host, 'request')
@@ -210,16 +207,22 @@
# Coerce everything to Unicode
text = tounicode(text, enc)
table = [tounicode(_t, enc) for _t in table]
- # Add the table to the end so it doesn't get wrapped/filled
- text += (header + '\n' + NL.join(table))
# Translate the message and headers to user's suggested lang
otrans = i18n.get_translation()
try:
i18n.set_language(poplang)
+ # Craft table header after language was set
+ header = '%-40s %-10s\n%-40s %-10s' % (
+ _('List'), _('Password // URL'), '----', '--------')
+ header = tounicode(header, enc)
+ # Add the table to the end so it doesn't get wrapped/filled
+ text += (header + '\n' + NL.join(table))
msg = Message.UserNotification(
addr, siteowner,
_('%(host)s mailing list memberships reminder'),
- text, poplang)
+ text.encode(enc, 'replace'), poplang)
+ # Note that text must be encoded into 'enc' because unicode
+ # cause error within email module in some language (Japanese).
finally:
i18n.set_translation(otrans)
msg['X-No-Archive'] = 'yes'
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org