------------------------------------------------------------
revno: 998
committer: Mark Sapiro <[EMAIL PROTECTED]>
branch nick: 2.2
timestamp: Tue 2008-08-19 17:56:58 -0700
message:
  Backported from the trunk -
    Confirmed member change of address is logged in the 'subscribe' log,
    and if admin_notify_mchanges is true, a notice is sent to the list
    owner using a new adminaddrchgack.txt template.
  
    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.
  
  Updated NEWS for a couple of prior changes.
added:
  templates/en/adminaddrchgack.txt
modified:
  Mailman/Defaults.py.in
  Mailman/Gui/Privacy.py
  Mailman/MailList.py
  Mailman/Version.py
  Mailman/versions.py
  NEWS

=== modified file 'Mailman/Defaults.py.in'
--- a/Mailman/Defaults.py.in    2008-06-30 15:32:26 +0000
+++ b/Mailman/Defaults.py.in    2008-08-20 00:56:58 +0000
@@ -990,6 +990,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

=== modified file 'Mailman/Gui/Privacy.py'
--- a/Mailman/Gui/Privacy.py    2007-11-19 01:59:38 +0000
+++ b/Mailman/Gui/Privacy.py    2008-08-20 00:56:58 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2008 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
@@ -113,6 +113,15 @@
 
             sub_cfentry,
 
+            ('subscribe_auto_approval', mm_cfg.EmailListEx, (10, WIDTH), 1,
+             _("""List of addresses (or regexps) whose subscriptions do not
+             require approval."""),
+
+             _("""When subscription requires approval, addresses in this list
+             are allowed to subscribe without administrator approval. Add
+             addresses one per line. You may begin a line with a ^ character
+             to designate a (case insensitive) regular expression match.""")),
+
             ('unsubscribe_policy', mm_cfg.Radio, (_('No'), _('Yes')), 0,
              _("""Is the list moderator's approval required for unsubscription
              requests?  (<em>No</em> is recommended)"""),

=== modified file 'Mailman/MailList.py'
--- a/Mailman/MailList.py       2008-06-30 15:32:26 +0000
+++ b/Mailman/MailList.py       2008-08-20 00:56:58 +0000
@@ -353,6 +353,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
@@ -914,6 +915,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
@@ -1142,6 +1146,7 @@
                 self.removeMember(oldaddr)
         else:
             self.changeMemberAddress(oldaddr, newaddr)
+            self.log_and_notify_admin(oldaddr, newaddr)
         # If globally is true, then we also include every list for which
         # oldaddr is a member.
         if not globally:
@@ -1167,10 +1172,39 @@
                         mlist.removeMember(oldaddr)
                 else:
                     mlist.changeMemberAddress(oldaddr, newaddr)
+                    self.log_and_notify_admin(oldaddr, newaddr)
                 mlist.Save()
             finally:
                 mlist.Unlock()
 
+    def log_and_notify_admin(self, oldaddr, newaddr):
+        """Log member address change and notify admin if requested."""
+        syslog('subscribe', '%s: changed member address from %s to %s',
+               self.internal_name(), oldaddr, newaddr)
+        if self.admin_notify_mchanges:
+            lang = self.preferred_language
+            otrans = i18n.get_translation()
+            i18n.set_language(lang)
+            try:
+                realname = self.real_name
+                subject = _('%(realname)s address change notification')
+            finally:
+                i18n.set_translation(otrans)
+            name = self.getMemberName(newaddr)
+            if name is None:
+                name = ''
+            if isinstance(name, UnicodeType):
+                name = name.encode(Utils.GetCharSet(lang), 'replace')
+            text = Utils.maketext(
+                'adminaddrchgack.txt',
+                {'name'    : name,
+                 'oldaddr' : oldaddr,
+                 'newaddr' : newaddr,
+                 'listname': self.real_name,
+                 }, mlist=self)
+            msg = Message.OwnerNotification(self, subject, text)
+            msg.send(self)
+
 
     #
     # Confirmation processing
@@ -1214,7 +1248,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, _(
@@ -1491,13 +1526,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
@@ -1505,12 +1557,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
 
 
 

=== modified file 'Mailman/Version.py'
--- a/Mailman/Version.py        2008-06-30 15:32:26 +0000
+++ b/Mailman/Version.py        2008-08-20 00:56:58 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2006 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2008 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
@@ -37,7 +37,7 @@
                (REL_LEVEL << 4)  | (REL_SERIAL << 0))
 
 # config.pck schema version number
-DATA_FILE_VERSION = 97
+DATA_FILE_VERSION = 98
 
 # qfile/*.db schema version number
 QFILE_SCHEMA_VERSION = 3

=== modified file 'Mailman/versions.py'
--- a/Mailman/versions.py       2007-11-25 07:08:04 +0000
+++ b/Mailman/versions.py       2008-08-20 00:56:58 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2007 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2008 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
@@ -348,6 +348,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)

=== modified file 'NEWS'
--- a/NEWS      2008-06-30 15:32:26 +0000
+++ b/NEWS      2008-08-20 00:56:58 +0000
@@ -4,6 +4,27 @@
 
 Here is a history of user visible changes to Mailman.
 
+2.2a0 (xx-xxx-xxxx)
+
+  New Features
+
+    - There is 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.
+
+    - Confirmed member change of address is logged in the 'subscribe' log,
+      and if admin_notify_mchanges is true, a notice is sent to the list
+      owner using a new adminaddrchgack.txt template.
+
+  Bug fixes and other patches
+
+      Fixed a bug in admin.py which would result in chunked pages of the
+      membership list for members whose address begins with a non-alphanumeric
+      character to not be visible or retrievable.
+
+      Changed ListAdmin.py to make rejected post messages From: the -owner
+      address instead of the -bounces address.
+
 2.1.11 (30-Jun-2008)
 
   New Features

=== added file 'templates/en/adminaddrchgack.txt'
--- a/templates/en/adminaddrchgack.txt  1970-01-01 00:00:00 +0000
+++ b/templates/en/adminaddrchgack.txt  2008-08-20 00:56:58 +0000
@@ -0,0 +1,4 @@
+Address for member %(name)s has been successfully changed
+from %(oldaddr)s to %(newaddr)s for list %(listname)s.
+
+



--
Dormant development version (web u/i update)
https://code.launchpad.net/~mailman-coders/mailman/2.2

You are receiving this branch notification because you are subscribed to it.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to