------------------------------------------------------------
revno: 1022
committer: Mark Sapiro <[EMAIL PROTECTED]>
branch nick: 2.1
timestamp: Sun 2007-11-25 08:12:16 -0800
message:
Merged Tokio's sibling list patch
modified:
Mailman/Defaults.py.in
Mailman/Gui/NonDigest.py
Mailman/Handlers/CalcRecips.py
Mailman/MailList.py
Mailman/Version.py
Mailman/versions.py
------------------------------------------------------------
revno: 1020.1.1
committer: Tokio Kikuchi <[EMAIL PROTECTED]>
branch nick: 2.1
timestamp: Sun 2007-11-25 16:08:04 +0900
message:
Add 'sibling list' feature: exclude and include lists are other mailing
lists whose members are exclude or included if they appear in To:
or Cc:. (Patch ID 1347962)
modified:
Mailman/Defaults.py.in
Mailman/Gui/NonDigest.py
Mailman/Handlers/CalcRecips.py
Mailman/MailList.py
Mailman/Version.py
Mailman/versions.py
=== modified file 'Mailman/Defaults.py.in'
--- a/Mailman/Defaults.py.in 2007-11-25 08:04:30 +0000
+++ b/Mailman/Defaults.py.in 2007-11-25 16:12:16 +0000
@@ -905,6 +905,11 @@
# administrative notices (subscription confirmations, password reminders):
DEFAULT_UMBRELLA_MEMBER_ADMIN_SUFFIX = "-owner"
+# Exclude/include (sibling) lists for non-digest delivery.
+DEFAULT_REGULAR_EXCLUDE_LISTS = []
+DEFAULT_REGULAR_INCLUDE_LISTS = []
+ALLOW_CROSS_DOMAIN_SIBLING = False
+
# This variable controls whether monthly password reminders are sent.
DEFAULT_SEND_REMINDERS = Yes
=== modified file 'Mailman/Gui/NonDigest.py'
--- a/Mailman/Gui/NonDigest.py 2005-08-27 01:40:17 +0000
+++ b/Mailman/Gui/NonDigest.py 2007-11-25 07:08:04 +0000
@@ -143,6 +143,30 @@
access via web browser. If you want the attachments totally
disappear, you can use content filter options.''')),
])
+
+ info.extend([
+ _('Sibling lists'),
+
+ ('regular_exclude_lists', mm_cfg.EmailList, (3, WIDTH), 0,
+ _('''Other mailing lists on this site whose members are
+ excluded from the regular (non-digest) delivery if those
+ list addresses appear in To: or Cc: header.'''),
+ _('''The list addresses should be written in full mail address
+ format (e.g. [EMAIL PROTECTED]). Do not specify this list
+ address mutually in the exclude list configuration page,
+ or those doubled members won't get any message. Note also that
+ the site administrator may prohibit cross domain sibling.''')),
+
+ ('regular_include_lists', mm_cfg.EmailList, (3, WIDTH), 0,
+ _('''Other mailing lists on this site whose members are
+ included in the regular (non-digest) delivery if those
+ list addresses don't appear in To: or Cc: header.'''),
+ _('''The list addresses should be written in full mail address
+ format (e.g. [EMAIL PROTECTED]). Note also that the site
+ administrator may prohibit cross domain sibling.''')),
+ ])
+
+
return info
def _setValue(self, mlist, property, val, doc):
=== modified file 'Mailman/Handlers/CalcRecips.py'
--- a/Mailman/Handlers/CalcRecips.py 2007-11-04 23:03:38 +0000
+++ b/Mailman/Handlers/CalcRecips.py 2007-11-25 07:08:04 +0000
@@ -23,13 +23,22 @@
SendmailDeliver and BulkDeliver modules.
"""
+import email.Utils
from Mailman import mm_cfg
from Mailman import Utils
from Mailman import Message
from Mailman import Errors
from Mailman.MemberAdaptor import ENABLED
+from Mailman.MailList import MailList
from Mailman.i18n import _
from Mailman.Logging.Syslog import syslog
+from Mailman.Errors import MMUnknownListError
+
+# Use set for sibling list recipient calculation
+try:
+ set
+except NameError: # Python2.3
+ from sets import Set as set
@@ -86,6 +95,9 @@
pass
# Handle topic classifications
do_topic_filters(mlist, msg, msgdata, recips)
+ # Regular delivery exclude/include (if in/not_in To: or Cc:) lists
+ recips = do_exclude(mlist, msg, msgdata, recips)
+ recips = do_include(mlist, msg, msgdata, recips)
# Bookkeeping
msgdata['recips'] = recips
@@ -135,4 +147,66 @@
# Prune out the non-receiving users
for user in zaprecips:
recips.remove(user)
-
+
+
+def do_exclude(mlist, msg, msgdata, recips):
+ # regular_exclude_lists are the other mailing lists on this mailman
+ # installation whose members are excluded from the regular (non-digest)
+ # delivery of this list if those list addresses appear in To: or Cc:
+ # headers.
+ if not mlist.regular_exclude_lists:
+ return recips
+ recips = set(recips)
+ destinations = email.Utils.getaddresses(msg.get_all('to', []) +
+ msg.get_all('cc', []))
+ destinations = [y for x,y in destinations]
+ for listname in mlist.regular_exclude_lists:
+ if listname not in destinations:
+ continue
+ listlhs, hostname = listname.split('@')
+ try:
+ slist = MailList(listlhs, lock=False)
+ except MMUnknownListError:
+ syslog('error', 'Exclude list %s not found.', listname)
+ continue
+ if not mm_cfg.ALLOW_CROSS_DOMAIN_SIBLING \
+ and slist.host_name != hostname:
+ syslog('error', 'Exclude list %s is not in the same domain.',
+ listname)
+ continue
+ srecips = set([slist.getMemberCPAddress(m)
+ for m in slist.getRegularMemberKeys()
+ if slist.getDeliveryStatus(m) == ENABLED])
+ recips -= srecips
+ return list(recips)
+
+
+def do_include(mlist, msg, msgdata, recips):
+ # regular_include_lists are the other mailing lists on this mailman
+ # installation whose members are included in the regular (non-digest)
+ # delivery if those list addresses don't appear in To: or Cc: headers.
+ if not mlist.regular_include_lists:
+ return recips
+ recips = set(recips)
+ destinations = email.Utils.getaddresses(msg.get_all('to', []) +
+ msg.get_all('cc', []))
+ destinations = [y for x,y in destinations]
+ for listname in mlist.regular_include_lists:
+ if listname in destinations:
+ continue
+ listlhs, hostname = listname.split('@')
+ try:
+ slist = MailList(listlhs, lock=False)
+ except MMUnknownListError:
+ syslog('error', 'Include list %s not found.', listname)
+ continue
+ if not mm_cfg.ALLOW_CROSS_DOMAIN_SIBLING \
+ and slist.host_name != hostname:
+ syslog('error', 'Include list %s is not in the same domain.',
+ listname)
+ continue
+ srecips = set([slist.getMemberCPAddress(m)
+ for m in slist.getRegularMemberKeys()
+ if slist.getDeliveryStatus(m) == ENABLED])
+ recips |= srecips
+ return list(recips)
=== modified file 'Mailman/MailList.py'
--- a/Mailman/MailList.py 2007-10-18 20:34:36 +0000
+++ b/Mailman/MailList.py 2007-11-25 07:08:04 +0000
@@ -337,6 +337,8 @@
self.umbrella_list = mm_cfg.DEFAULT_UMBRELLA_LIST
self.umbrella_member_suffix = \
mm_cfg.DEFAULT_UMBRELLA_MEMBER_ADMIN_SUFFIX
+ self.regular_exclude_lists = mm_cfg.DEFAULT_REGULAR_EXCLUDE_LISTS
+ self.regular_include_lists = mm_cfg.DEFAULT_REGULAR_INCLUDE_LISTS
self.send_reminders = mm_cfg.DEFAULT_SEND_REMINDERS
self.send_welcome_msg = mm_cfg.DEFAULT_SEND_WELCOME_MSG
self.send_goodbye_msg = mm_cfg.DEFAULT_SEND_GOODBYE_MSG
=== modified file 'Mailman/Version.py'
--- a/Mailman/Version.py 2006-09-13 14:12:57 +0000
+++ b/Mailman/Version.py 2007-11-25 07:08:04 +0000
@@ -37,7 +37,7 @@
(REL_LEVEL << 4) | (REL_SERIAL << 0))
# config.pck schema version number
-DATA_FILE_VERSION = 96
+DATA_FILE_VERSION = 97
# qfile/*.db schema version number
QFILE_SCHEMA_VERSION = 3
=== modified file 'Mailman/versions.py'
--- a/Mailman/versions.py 2007-11-22 19:15:26 +0000
+++ b/Mailman/versions.py 2007-11-25 07:08:04 +0000
@@ -409,6 +409,11 @@
# multipart/alternative collapse
add_only_if_missing('collapse_alternatives',
mm_cfg.DEFAULT_COLLAPSE_ALTERNATIVES)
+ # exclude/include lists
+ add_only_if_missing('regular_exclude_lists',
+ mm_cfg.DEFAULT_REGULAR_EXCLUDE_LISTS)
+ add_only_if_missing('regular_include_lists',
+ mm_cfg.DEFAULT_REGULAR_INCLUDE_LISTS)
--
https://code.launchpad.net/~mailman-coders/mailman/2.1
You are receiving this branch notification because you are subscribed to it.
To unsubscribe from this branch go to
https://code.launchpad.net/~mailman-coders/mailman/2.1/+subscription/mailman-checkins.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org