------------------------------------------------------------ revno: 1526 fixes bug: https://launchpad.net/bugs/1417093 committer: Mark Sapiro <m...@msapiro.net> branch nick: 2.1 timestamp: Tue 2015-02-03 20:48:25 -0800 message: Enhanced subscribe_auto_approval to accept @listname entries. modified: Mailman/Gui/GUIBase.py Mailman/Gui/Privacy.py Mailman/MailList.py NEWS
-- lp:mailman/2.1 https://code.launchpad.net/~mailman-coders/mailman/2.1 Your team Mailman Checkins is subscribed to branch lp:mailman/2.1. To unsubscribe from this branch go to https://code.launchpad.net/~mailman-coders/mailman/2.1/+edit-subscription
=== modified file 'Mailman/Gui/GUIBase.py' --- Mailman/Gui/GUIBase.py 2013-07-12 22:11:08 +0000 +++ Mailman/Gui/GUIBase.py 2015-02-04 04:48:25 +0000 @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2008 by the Free Software Foundation, Inc. +# Copyright (C) 2002-2015 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 @@ -80,7 +80,8 @@ except re.error: bad_addrs.append(addr) elif (wtype == mm_cfg.EmailListEx and addr.startswith('@') - and property.endswith('_these_nonmembers')): + and (property.endswith('_these_nonmembers') or + property == 'subscribe_auto_approval')): # XXX Needs to be reviewed for list@domain names. # don't reference your own list if addr[1:] == mlist.internal_name(): === modified file 'Mailman/Gui/Privacy.py' --- Mailman/Gui/Privacy.py 2015-01-24 01:35:45 +0000 +++ Mailman/Gui/Privacy.py 2015-02-04 04:48:25 +0000 @@ -117,10 +117,13 @@ _("""List of addresses (or regexps) whose subscriptions do not require approval."""), - _("""When subscription requires approval, addresses in this list + (_("""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.""")), + to designate a (case insensitive) regular expression match.""") + + ' ' + + _("""You may also use the @listname notation to designate the + members of another list in this installation."""))), ('unsubscribe_policy', mm_cfg.Radio, (_('No'), _('Yes')), 0, _("""Is the list moderator's approval required for unsubscription === modified file 'Mailman/MailList.py' --- Mailman/MailList.py 2015-01-24 01:35:45 +0000 +++ Mailman/MailList.py 2015-02-04 04:48:25 +0000 @@ -1568,16 +1568,17 @@ def HasAutoApprovedSender(self, sender): """Returns True and logs if sender matches address or pattern - in subscribe_auto_approval. Otherwise returns False. + or is a member of a referenced list in subscribe_auto_approval. + Otherwise returns False. """ auto_approve = False - if self.GetPattern(sender, self.subscribe_auto_approval): + if self.GetPattern(sender, self.subscribe_auto_approval, at_list=True): auto_approve = True syslog('vette', '%s: auto approved subscribe from %s', self.internal_name(), sender) return auto_approve - def GetPattern(self, email, pattern_list): + def GetPattern(self, email, pattern_list, at_list=False): """Returns matched entry in pattern_list if email matches. Otherwise returns None. """ @@ -1592,6 +1593,27 @@ except re.error: # BAW: we should probably remove this pattern pass + elif at_list and pattern.startswith('@'): + # XXX Needs to be reviewed for list@domain names. + # this refers to the members of another list in this + # installation. + mname = pattern[1:].lower().strip() + if mname == self.internal_name(): + # don't reference your own list + syslog('error', + 'subscribe_auto_approval in %s references own list', + self.internal_name()) + continue + try: + mother = MailList(mname, lock = False) + except Errors.MMUnknownListError: + syslog('error', + 'subscribe_auto_approval in %s references non-existent list %s', + self.internal_name(), mname) + continue + if mother.isMember(email.lower()): + matched = pattern + break else: # Do the comparison case insensitively if pattern.lower() == email.lower(): === modified file 'NEWS' --- NEWS 2015-01-30 20:04:52 +0000 +++ NEWS 2015-02-04 04:48:25 +0000 @@ -64,6 +64,10 @@ New Features + - The subscribe_auto_approval feature backported from the 2.2 branch and + described above has been enhanced to accept entries of the form + @listname to auto approve members of another list. (LP: #1417093) + - There is a new list attribute dmarc_wrapped_message_text and a DEFAULT_DMARC_WRAPPED_MESSAGE_TEXT setting to set the default for new lists. This text is added to a message which is wrapped because of
_______________________________________________ Mailman-checkins mailing list Mailman-checkins@python.org Unsubscribe: https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org