------------------------------------------------------------
revno: 6567
committer: Barry Warsaw <[EMAIL PROTECTED]>
branch nick: 3.0
timestamp: Wed 2007-10-10 00:16:12 -0400
message:
  Remove the action.py module, move this to Mailman/interfaces/__init__.py.
  
  Convert IMailingList.personalize to a enum.
  
  Change all non-obsolete occurances of GetListEmail() to posting_address.
removed:
  Mailman/interfaces/action.py
modified:
  Mailman/Commands/cmd_info.py
  Mailman/Handlers/CookHeaders.py
  Mailman/Handlers/SMTPDirect.py
  Mailman/Handlers/ToOutgoing.py
  Mailman/MailList.py
  Mailman/app/styles.py
  Mailman/bin/gate_news.py
  Mailman/bin/withlist.py
  Mailman/database/model/mailinglist.py
  Mailman/docs/cook-headers.txt
  Mailman/docs/news-runner.txt
  Mailman/docs/outgoing.txt
  Mailman/interfaces/__init__.py
  Mailman/interfaces/mailinglist.py
  Mailman/queue/news.py

=== removed file 'Mailman/interfaces/action.py'
--- a/Mailman/interfaces/action.py      2007-10-10 02:18:14 +0000
+++ b/Mailman/interfaces/action.py      1970-01-01 00:00:00 +0000
@@ -1,31 +0,0 @@
-# Copyright (C) 2006-2007 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
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-__all__ = [
-    'Action',
-    ]
-
-from munepy import Enum
-
-
-
-class Action(Enum):
-    hold    = 0
-    reject  = 1
-    discard = 2
-    accept  = 3
-    defer   = 4

=== modified file 'Mailman/Commands/cmd_info.py'
--- a/Mailman/Commands/cmd_info.py      2007-01-19 04:38:06 +0000
+++ b/Mailman/Commands/cmd_info.py      2007-10-10 04:16:12 +0000
@@ -37,10 +37,10 @@
         return STOP
     listname = mlist.real_name
     description = mlist.description or _('n/a')
-    postaddr = mlist.GetListEmail()
-    requestaddr = mlist.GetRequestEmail()
-    owneraddr = mlist.GetOwnerEmail()
-    listurl = mlist.GetScriptURL('listinfo', absolute=1)
+    postaddr = mlist.posting_address
+    requestaddr = mlist.request_address
+    owneraddr = mlist.owner_address
+    listurl = mlist.script_url('listinfo')
     res.results.append(_('List name:    %(listname)s'))
     res.results.append(_('Description:  %(description)s'))
     res.results.append(_('Postings to:  %(postaddr)s'))

=== modified file 'Mailman/Handlers/CookHeaders.py'
--- a/Mailman/Handlers/CookHeaders.py   2007-10-10 02:18:14 +0000
+++ b/Mailman/Handlers/CookHeaders.py   2007-10-10 04:16:12 +0000
@@ -29,7 +29,7 @@
 from Mailman.app.archiving import get_base_archive_url
 from Mailman.configuration import config
 from Mailman.i18n import _
-from Mailman.interfaces import ReplyToMunging
+from Mailman.interfaces import Personalization, ReplyToMunging
 
 CONTINUATION = ',\n\t'
 COMMASPACE = ', '
@@ -148,7 +148,7 @@
         # above code?
         # Also skip Cc if this is an anonymous list as list posting address
         # is already in From and Reply-To in this case.
-        if (mlist.personalize == 2 and
+        if (mlist.personalize == Personalization.full and
             mlist.reply_goes_to_list <> ReplyToMunging.point_to_list and
             not mlist.anonymous_list):
             # Watch out for existing Cc headers, merge, and remove dups.  Note
@@ -158,7 +158,7 @@
             for pair in getaddresses(msg.get_all('cc', [])):
                 add(pair)
             i18ndesc = uheader(mlist, mlist.description, 'Cc')
-            add((str(i18ndesc), mlist.GetListEmail()))
+            add((str(i18ndesc), mlist.posting_address))
             del msg['Cc']
             msg['Cc'] = COMMASPACE.join([formataddr(pair) for pair in new])
     # Add list-specific headers as defined in RFC 2369 and RFC 2919, but only

=== modified file 'Mailman/Handlers/SMTPDirect.py'
--- a/Mailman/Handlers/SMTPDirect.py    2007-01-19 04:38:06 +0000
+++ b/Mailman/Handlers/SMTPDirect.py    2007-10-10 04:16:12 +0000
@@ -42,6 +42,7 @@
 from Mailman.Handlers import Decorate
 from Mailman.SafeDict import MsgSafeDict
 from Mailman.configuration import config
+from Mailman.interfaces import Personalization
 
 DOT = '.'
 
@@ -114,7 +115,7 @@
     # recipients they'll swallow in a single transaction.
     deliveryfunc = None
     if (not msgdata.has_key('personalize') or msgdata['personalize']) and (
-           msgdata.get('verp') or mlist.personalize):
+           msgdata.get('verp') or mlist.personalize <> Personalization.none):
         chunks = [[recip] for recip in recips]
         msgdata['personalize'] = 1
         deliveryfunc = verpdeliver
@@ -301,7 +302,7 @@
                  'host'   : DOT.join(rdomain),
                  }
             envsender = '[EMAIL PROTECTED]' % ((config.VERP_FORMAT % d), 
DOT.join(bdomain))
-        if mlist.personalize == 2:
+        if mlist.personalize == Personalization.full:
             # When fully personalizing, we want the To address to point to the
             # recipient, not to the mailing list
             del msgcopy['to']

=== modified file 'Mailman/Handlers/ToOutgoing.py'
--- a/Mailman/Handlers/ToOutgoing.py    2007-09-29 18:55:25 +0000
+++ b/Mailman/Handlers/ToOutgoing.py    2007-10-10 04:16:12 +0000
@@ -23,6 +23,7 @@
 """
 
 from Mailman.configuration import config
+from Mailman.interfaces import Personalization
 from Mailman.queue import Switchboard
 
 
@@ -39,7 +40,7 @@
     # VERP_PASSWORD_REMINDERS.  Preserve any existing verp flag.
     if 'verp' in  msgdata:
         pass
-    elif mlist.personalize:
+    elif mlist.personalize <> Personalization.none:
         if config.VERP_PERSONALIZED_DELIVERIES:
             msgdata['verp'] = True
     elif interval == 0:

=== modified file 'Mailman/MailList.py'
--- a/Mailman/MailList.py       2007-09-28 02:15:00 +0000
+++ b/Mailman/MailList.py       2007-10-10 04:16:12 +0000
@@ -184,9 +184,6 @@
         else:
             return 'confirm ' + cookie
 
-    def GetListEmail(self):
-        return self.getListAddress()
-
     def GetMemberAdminEmail(self, member):
         """Usually the member addr, but modified for umbrella lists.
 

=== modified file 'Mailman/app/styles.py'
--- a/Mailman/app/styles.py     2007-10-10 02:18:14 +0000
+++ b/Mailman/app/styles.py     2007-10-10 04:16:12 +0000
@@ -17,6 +17,12 @@
 
 """Application of list styles to new and existing lists."""
 
+__metaclass__ = type
+__all__ = [
+    'DefaultStyle',
+    'style_manager',
+    ]
+
 import datetime
 
 from operator import attrgetter
@@ -27,14 +33,8 @@
 from Mailman.Errors import DuplicateStyleError
 from Mailman.app.plugins import get_plugins
 from Mailman.configuration import config
-from Mailman.interfaces import Action, IStyle, IStyleManager
-
-
-__metaclass__ = type
-__all__ = [
-    'DefaultStyle',
-    'style_manager',
-    ]
+from Mailman.interfaces import (
+    Action, IStyle, IStyleManager, NewsModeration, Personalization)
 
 
 
@@ -109,7 +109,7 @@
         mlist.digest_members = {}
         mlist.next_digest_number = 1
         mlist.nondigestable = config.DEFAULT_NONDIGESTABLE
-        mlist.personalize = False
+        mlist.personalize = Personalization.none
         # New sender-centric moderation (privacy) options
         mlist.default_member_moderation = (
             config.DEFAULT_DEFAULT_MEMBER_MODERATION)
@@ -126,7 +126,8 @@
         mlist.reject_these_nonmembers = []
         mlist.discard_these_nonmembers = []
         mlist.forward_auto_discards = config.DEFAULT_FORWARD_AUTO_DISCARDS
-        mlist.generic_nonmember_action = 
config.DEFAULT_GENERIC_NONMEMBER_ACTION
+        mlist.generic_nonmember_action = (
+            config.DEFAULT_GENERIC_NONMEMBER_ACTION)
         mlist.nonmember_rejection_notice = ''
         # Ban lists
         mlist.ban_list = []
@@ -192,7 +193,7 @@
         mlist.news_prefix_subject_too = True
         # In patch #401270, this was called newsgroup_is_moderated, but the
         # semantics weren't quite the same.
-        mlist.news_moderation = False
+        mlist.news_moderation = NewsModeration.none
         # Topics
         #
         # `topics' is a list of 4-tuples of the following form:

=== modified file 'Mailman/bin/gate_news.py'
--- a/Mailman/bin/gate_news.py  2007-09-29 18:55:25 +0000
+++ b/Mailman/bin/gate_news.py  2007-10-10 04:16:12 +0000
@@ -117,7 +117,7 @@
                     found_to = True
                 if value <> 'x-beenthere':
                     continue
-                if header[i:] == ': %s' % mlist.GetListEmail():
+                if header[i:] == ': %s' % mlist.posting_address:
                     beenthere = True
                     break
             if not beenthere:
@@ -146,7 +146,7 @@
                     del msg['X-Originally-To']
                     msg['X-Originally-To'] = msg['To']
                     del msg['To']
-                msg['To'] = mlist.GetListEmail()
+                msg['To'] = mlist.posting_address
                 # Post the message to the locked list
                 inq = Switchboard(config.INQUEUE_DIR)
                 inq.enqueue(msg,

=== modified file 'Mailman/bin/withlist.py'
--- a/Mailman/bin/withlist.py   2007-09-29 15:09:14 +0000
+++ b/Mailman/bin/withlist.py   2007-10-10 04:16:12 +0000
@@ -98,10 +98,10 @@
 two functions:
 
     def listaddr(mlist):
-        print mlist.GetListEmail()
+        print mlist.posting_address
 
     def requestaddr(mlist):
-        print mlist.GetRequestEmail()
+        print mlist.request_address
 
 Now, from the command line you can print the list's posting address by running
 the following from the command line:

=== modified file 'Mailman/database/model/mailinglist.py'
--- a/Mailman/database/model/mailinglist.py     2007-10-06 19:09:34 +0000
+++ b/Mailman/database/model/mailinglist.py     2007-10-10 04:16:12 +0000
@@ -23,7 +23,7 @@
 
 from Mailman.Utils import fqdn_listname, makedirs, split_listname
 from Mailman.configuration import config
-from Mailman.interfaces import IMailingList
+from Mailman.interfaces import IMailingList, Personalization
 from Mailman.database.types import EnumType, TimeDeltaType
 
 SPACE = ' '
@@ -124,7 +124,7 @@
     has_field('msg_footer',                                 Unicode),
     has_field('msg_header',                                 Unicode),
     has_field('new_member_options',                         Integer),
-    has_field('news_moderation',                            Boolean),
+    has_field('news_moderation',                            EnumType),
     has_field('news_prefix_subject_too',                    Boolean),
     has_field('nntp_host',                                  Unicode),
     has_field('nondigestable',                              Boolean),
@@ -132,7 +132,7 @@
     has_field('obscure_addresses',                          Boolean),
     has_field('pass_filename_extensions',                   PickleType),
     has_field('pass_mime_types',                            PickleType),
-    has_field('personalize',                                Integer),
+    has_field('personalize',                                EnumType),
     has_field('post_id',                                    Integer),
     has_field('preferred_language',                         Unicode),
     has_field('private_roster',                             Boolean),
@@ -174,7 +174,9 @@
         # autoresponses sent on that date.
         self.hold_and_cmd_autoresponses = {}
         self.full_path = os.path.join(config.LIST_DATA_DIR, fqdn_listname)
-        self.real_name = 
string.capwords(SPACE.join(listname.split(UNDERSCORE)))
+        self.personalization = Personalization.none
+        self.real_name = string.capwords(
+            SPACE.join(listname.split(UNDERSCORE)))
         makedirs(self.full_path)
 
     # XXX FIXME

=== modified file 'Mailman/docs/cook-headers.txt'
--- a/Mailman/docs/cook-headers.txt     2007-09-21 12:51:38 +0000
+++ b/Mailman/docs/cook-headers.txt     2007-10-10 04:16:12 +0000
@@ -292,3 +292,37 @@
     List-Unsubscribe: <http://lists.example.com/listinfo/[EMAIL PROTECTED]>,
        <mailto:[EMAIL PROTECTED]>
     ---end---
+
+
+Personalization
+---------------
+
+The To field normally contains the list posting address.  However when
+messages are fully personalized, that header will get overwritten with the
+address of the recipient.  The list's posting address will be added to one of
+the recipient headers so that users will be able to reply back to the list.
+
+    >>> from Mailman.interfaces import Personalization, ReplyToMunging
+    >>> mlist.personalize = Personalization.full
+    >>> mlist.reply_goes_to_list = ReplyToMunging.no_munging
+    >>> flush()
+    >>> msg = message_from_string("""\
+    ... From: [EMAIL PROTECTED]
+    ...
+    ... """, Message)
+    >>> process(mlist, msg, {})
+    >>> print msg.as_string()
+    From: [EMAIL PROTECTED]
+    X-BeenThere: [EMAIL PROTECTED]
+    X-Mailman-Version: ...
+    Precedence: list
+    Cc: My test mailing list <[EMAIL PROTECTED]>
+    List-Id: My test mailing list <_xtest.example.com>
+    List-Unsubscribe: <http://lists.example.com/listinfo/[EMAIL PROTECTED]>,
+       <mailto:[EMAIL PROTECTED]>
+    List-Post: <mailto:[EMAIL PROTECTED]>
+    List-Help: <mailto:[EMAIL PROTECTED]>
+    List-Subscribe: <http://lists.example.com/listinfo/[EMAIL PROTECTED]>,
+       <mailto:[EMAIL PROTECTED]>
+    <BLANKLINE>
+    <BLANKLINE>

=== modified file 'Mailman/docs/news-runner.txt'
--- a/Mailman/docs/news-runner.txt      2007-09-29 18:55:25 +0000
+++ b/Mailman/docs/news-runner.txt      2007-10-10 04:16:12 +0000
@@ -116,4 +116,50 @@
     <BLANKLINE>
 
 
+Newsgroup moderation
+--------------------
+
+When the newsgroup is moderated, an Approved: header with the list's posting
+address is added for the benefit of the Usenet system.
+
+    >>> from Mailman.interfaces import NewsModeration
+    >>> mlist.news_moderation = NewsModeration.open_moderated
+    >>> flush()
+    >>> msg = message_from_string("""\
+    ... From: [EMAIL PROTECTED]
+    ... To: [EMAIL PROTECTED]
+    ... Approved: this gets deleted
+    ...
+    ... """)
+    >>> prepare_message(mlist, msg, {})
+    >>> msg['approved']
+    '[EMAIL PROTECTED]'
+
+    >>> mlist.news_moderation = NewsModeration.moderated
+    >>> flush()
+    >>> msg = message_from_string("""\
+    ... From: [EMAIL PROTECTED]
+    ... To: [EMAIL PROTECTED]
+    ... Approved: this gets deleted
+    ...
+    ... """)
+    >>> prepare_message(mlist, msg, {})
+    >>> msg['approved']
+    '[EMAIL PROTECTED]'
+
+But if the newsgroup is not moderated, the Approved: header is not chnaged.
+
+    >>> mlist.news_moderation = NewsModeration.none
+    >>> flush()
+    >>> msg = message_from_string("""\
+    ... From: [EMAIL PROTECTED]
+    ... To: [EMAIL PROTECTED]
+    ... Approved: this doesn't get deleted
+    ...
+    ... """)
+    >>> prepare_message(mlist, msg, {})
+    >>> msg['approved']
+    "this doesn't get deleted"
+
+
 XXX More of the NewsRunner should be tested.

=== modified file 'Mailman/docs/outgoing.txt'
--- a/Mailman/docs/outgoing.txt 2007-09-29 18:55:25 +0000
+++ b/Mailman/docs/outgoing.txt 2007-10-10 04:16:12 +0000
@@ -70,7 +70,8 @@
 option to VERP personalized deliveries is set, then the message will be
 VERP'd.
 
-    >>> mlist.personalize = True
+    >>> from Mailman.interfaces import Personalization
+    >>> mlist.personalize = Personalization.individual
     >>> flush()
     >>> config.VERP_PERSONALIZED_DELIVERIES = True
     >>> msgdata = dict(foo=1, bar=2)
@@ -96,7 +97,7 @@
 Mailman how often to VERP even non-personalized mailing lists.  It can be set
 to zero, which means non-personalized messages will never be VERP'd.
 
-    >>> mlist.personalize = False
+    >>> mlist.personalize = Personalization.none
     >>> flush()
     >>> config.VERP_DELIVERY_INTERVAL = 0
     >>> msgdata = dict(foo=1, bar=2)

=== modified file 'Mailman/interfaces/__init__.py'
--- a/Mailman/interfaces/__init__.py    2007-08-08 04:24:13 +0000
+++ b/Mailman/interfaces/__init__.py    2007-10-10 04:16:12 +0000
@@ -22,7 +22,10 @@
 from zope.interface import implementedBy
 from zope.interface.interfaces import IInterface
 
-__all__ = []
+__all__ = [
+    'Action',
+    'NewsModeration',
+    ]
 
 
 
@@ -49,3 +52,22 @@
 
 
 _populate()
+
+
+
+class Action(Enum):
+    hold    = 0
+    reject  = 1
+    discard = 2
+    accept  = 3
+    defer   = 4
+
+
+
+class NewsModeration(Enum):
+    # The newsgroup is not moderated
+    none = 0
+    # The newsgroup is moderated, but allows for an open posting policy.
+    open_moderated = 1
+    # The newsgroup is moderated
+    moderated = 2

=== modified file 'Mailman/interfaces/mailinglist.py'
--- a/Mailman/interfaces/mailinglist.py 2007-10-10 02:18:14 +0000
+++ b/Mailman/interfaces/mailinglist.py 2007-10-10 04:16:12 +0000
@@ -19,6 +19,7 @@
 
 __all__ = [
     'IMailingList',
+    'Personalization',
     'ReplyToMunging',
     ]
 
@@ -27,6 +28,17 @@
 
 
 
+class Personalization(Enum):
+    none = 0
+    # Everyone gets a unique copy of the message, and there are a few more
+    # substitution variables, but no headers are modified.
+    individual = 1
+    # All of the 'individual' personalization plus recipient header
+    # modification.
+    full = 2
+
+
+
 class ReplyToMunging(Enum):
     # The Reply-To header is passed through untouched
     no_munging = 0

=== modified file 'Mailman/queue/news.py'
--- a/Mailman/queue/news.py     2007-09-29 18:55:25 +0000
+++ b/Mailman/queue/news.py     2007-10-10 04:16:12 +0000
@@ -30,6 +30,7 @@
 
 from Mailman import Utils
 from Mailman.configuration import config
+from Mailman.interfaces import NewsModeration
 from Mailman.queue import Runner
 
 log = logging.getLogger('mailman.error')
@@ -92,9 +93,10 @@
     # software to accept the posting, and not forward it on to the n.g.'s
     # moderation address.  The posting would not have gotten here if it hadn't
     # already been approved.  1 == open list, mod n.g., 2 == moderated
-    if mlist.news_moderation in (1, 2):
+    if mlist.news_moderation in (NewsModeration.open_moderated,
+                                 NewsModeration.moderated):
         del msg['approved']
-        msg['Approved'] = mlist.GetListEmail()
+        msg['Approved'] = mlist.posting_address
     # Should we restore the original, non-prefixed subject for gatewayed
     # messages? TK: We use stripped_subject (prefix stripped) which was
     # crafted in CookHeaders.py to ensure prefix was stripped from the subject



--

https://code.launchpad.net/~mailman-coders/mailman/3.0

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/3.0/+subscription/mailman-checkins.
_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to