Update of /cvsroot/mailman/mailman/Mailman
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30399/Mailman
Modified Files:
Defaults.py.in MailList.py Version.py versions.py
Log Message:
Added a new list attribute 'subscribe_auto_approval' which is a list of email
addresses
and regular expressions matching email addresses whose subscriptions are exempt
from admin approval. RFE 403066.
Index: Defaults.py.in
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Defaults.py.in,v
retrieving revision 2.137
retrieving revision 2.138
diff -u -d -r2.137 -r2.138
--- Defaults.py.in 18 Mar 2006 17:28:22 -0000 2.137
+++ Defaults.py.in 18 Mar 2006 18:15:53 -0000 2.138
@@ -942,6 +942,10 @@
# Does this site allow completely unchecked subscriptions?
ALLOW_OPEN_SUBSCRIBE = No
+# This is the default list of addresses and regular expressions (beginning
+# with ^) that are exempt from approval if SUBSCRIBE_POLICY is 2 or 3.
+DEFAULT_SUBSCRIBE_AUTO_APPROVAL = []
+
# The default policy for unsubscriptions. 0 (unmoderated unsubscribes) is
# highly recommended!
# 0 - unmoderated unsubscribes
Index: MailList.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/MailList.py,v
retrieving revision 2.118
retrieving revision 2.119
diff -u -d -r2.118 -r2.119
--- MailList.py 12 Mar 2006 02:26:34 -0000 2.118
+++ MailList.py 18 Mar 2006 18:15:53 -0000 2.119
@@ -351,6 +351,7 @@
self.welcome_msg = ''
self.goodbye_msg = ''
self.subscribe_policy = mm_cfg.DEFAULT_SUBSCRIBE_POLICY
+ self.subscribe_auto_approval = mm_cfg.DEFAULT_SUBSCRIBE_AUTO_APPROVAL
self.unsubscribe_policy = mm_cfg.DEFAULT_UNSUBSCRIBE_POLICY
self.private_roster = mm_cfg.DEFAULT_PRIVATE_ROSTER
self.obscure_addresses = mm_cfg.DEFAULT_OBSCURE_ADDRESSES
@@ -905,6 +906,9 @@
syslog('subscribe', '%s: pending %s %s',
self.internal_name(), who, by)
raise Errors.MMSubscribeNeedsConfirmation
+ elif self.HasAutoApprovedSender(email):
+ # no approval necessary:
+ self.ApprovedAddMember(userdesc)
else:
# Subscription approval is required. Add this entry to the admin
# requests database. BAW: this should probably take a userdesc
@@ -1225,7 +1229,8 @@
# list administrators.
self.SendHostileSubscriptionNotice(invitation, addr)
raise Errors.HostileSubscriptionError
- elif self.subscribe_policy in (2, 3):
+ elif self.subscribe_policy in (2, 3) and \
+ not self.HasAutoApprovedSender(addr):
self.HoldSubscription(addr, fullname, password, digest, lang)
name = self.real_name
raise Errors.MMNeedApproval, _(
@@ -1502,13 +1507,30 @@
"""Returns matched entry in ban_list if email matches.
Otherwise returns None.
"""
- ban = False
- for pattern in self.ban_list:
+ return self.GetPattern(email, self.ban_list)
+
+ def HasAutoApprovedSender(self, sender):
+ """Returns True and logs if sender matches address or pattern
+ in subscribe_auto_approval. Otherwise returns False.
+ """
+ auto_approve = False
+ if self.GetPattern(sender, self.subscribe_auto_approval):
+ auto_approve = True
+ syslog('vette', '%s: auto approved subscribe from %s',
+ self.internal_name(), sender)
+ return auto_approve
+
+ def GetPattern(self, email, pattern_list):
+ """Returns matched entry in pattern_list if email matches.
+ Otherwise returns None.
+ """
+ matched = None
+ for pattern in pattern_list:
if pattern.startswith('^'):
# This is a regular expression match
try:
if re.search(pattern, email, re.IGNORECASE):
- ban = True
+ matched = pattern
break
except re.error:
# BAW: we should probably remove this pattern
@@ -1516,12 +1538,9 @@
else:
# Do the comparison case insensitively
if pattern.lower() == email.lower():
- ban = True
+ matched = pattern
break
- if ban:
- return pattern
- else:
- return None
+ return matched
Index: Version.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Version.py,v
retrieving revision 2.57
retrieving revision 2.58
diff -u -d -r2.57 -r2.58
--- Version.py 28 Aug 2005 05:31:26 -0000 2.57
+++ Version.py 18 Mar 2006 18:15:53 -0000 2.58
@@ -36,7 +36,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
Index: versions.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/versions.py,v
retrieving revision 2.41
retrieving revision 2.42
diff -u -d -r2.41 -r2.42
--- versions.py 30 Dec 2005 18:56:44 -0000 2.41
+++ versions.py 18 Mar 2006 18:15:53 -0000 2.42
@@ -345,6 +345,8 @@
add_only_if_missing('personalize', 0)
add_only_if_missing('first_strip_reply_to',
mm_cfg.DEFAULT_FIRST_STRIP_REPLY_TO)
+ add_only_if_missing('subscribe_auto_approval',
+ mm_cfg.DEFAULT_SUBSCRIBE_AUTO_APPROVAL)
add_only_if_missing('unsubscribe_policy',
mm_cfg.DEFAULT_UNSUBSCRIBE_POLICY)
add_only_if_missing('send_goodbye_msg', mm_cfg.DEFAULT_SEND_GOODBYE_MSG)
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org