[Mailman-Developers] Re: Patch: Optionally Suppressing List Headers - v2

ps@psncc.at ps@psncc.at
Thu, 5 Apr 2001 07:50:25 +0200 (CEST)


Hi everybody,

Having read the replies for my previous patch so far, I have produced
version 2 of it.

I would also like to note that the functionality applies to both regular
and digest messages anyway, so one of the comments from my last posts
should be treated as nonsense.

Due to this, I have now moved the configurabale option to the "general"
options page, and I have properly (?) changed the versions.py file to
upgrade mailing lists for the new attribute on-the-fly (I didn't know of
the functionality, although I thought it would be hidden somewhere -
Barrys mail has pointed me in the right direction). However, this required
to increase the DATA_FILE_VERSION in Mailman/Version.py as well
(something I was not THAT comfortable with).

It also includes a configurable default value for the new attribute as
well.

I would really like to hear comments on the proposed functionality as well
as on the patch's quality (which [indirectly, though] seems to have been
the focus of most, if not all, of the replies to my last posting).

peter



Here is the patch:


diff -ur mailman-2.0.2-org/Mailman/Defaults.py.in mailman-2.0.2-patched/Mailman/Defaults.py.in
--- mailman-2.0.2-org/Mailman/Defaults.py.in	Thu Nov 16 05:23:52 2000
+++ mailman-2.0.2-patched/Mailman/Defaults.py.in	Thu Apr  5 07:02:20 2001
@@ -366,6 +366,11 @@
                                      'subject', 'to', 'cc',
                                      'reply-to', 'organization']

+#####
+# Add list header, ie. List-Help, etc. to outgoing non-digest
+# messages
+#####
+DEFAULT_ADDLISTINFO = 1


 #####
diff -ur mailman-2.0.2-org/Mailman/Handlers/CookHeaders.py mailman-2.0.2-patched/Mailman/Handlers/CookHeaders.py
--- mailman-2.0.2-org/Mailman/Handlers/CookHeaders.py	Thu Nov 16 05:35:09 2000
+++ mailman-2.0.2-patched/Mailman/Handlers/CookHeaders.py	Wed Apr  4 23:13:39 2001
@@ -124,14 +124,15 @@
         # Wrap these lines if they are too long.  78 character width probably
         # shouldn't be hardcoded.  The adding of 2 is for the colon-space
         # separator.
-        if len(h) + 2 + len(v) > 78:
-            v = string.join(string.split(v, ', '), ',\n\t')
-        msg[h] = v
+        if mlist.addlistinfo:
+            if len(h) + 2 + len(v) > 78:
+                v = string.join(string.split(v, ', '), ',\n\t')
+            msg[h] = v
     #
     # Always delete List-Archive header, but only add it back if the list is
     # actually archiving
     del msg['List-Archive']
-    if mlist.archive:
+    if mlist.archive and mlist.addlistinfo:
         value = '<%s>' % urlparse.urljoin(mlist.web_page_url,
                                           mlist.GetBaseArchiveURL())
         msg['List-Archive'] = value
diff -ur mailman-2.0.2-org/Mailman/MailList.py mailman-2.0.2-patched/Mailman/MailList.py
--- mailman-2.0.2-org/Mailman/MailList.py	Thu Nov 16 05:33:27 2000
+++ mailman-2.0.2-patched/Mailman/MailList.py	Thu Apr  5 07:31:07 2001
@@ -345,6 +345,8 @@
 	self.msg_header = mm_cfg.DEFAULT_MSG_HEADER
 	self.msg_footer = mm_cfg.DEFAULT_MSG_FOOTER

+	self.addlistinfo = mm_cfg.DEFAULT_ADDLISTINFO
+
     def GetConfigInfo(self):
 	config_info = {}
 	config_info['digest'] = Digester.GetConfigInfo(self)
@@ -544,6 +546,10 @@

 	    ('max_message_size', mm_cfg.Number, 7, 0,
 	     'Maximum length in Kb of a message body.  Use 0 for no limit.'),
+
+	    ('addlistinfo', mm_cfg.Toggle, ('No', 'Yes'), 1,
+	     'Add mailing list information headers to outgoing messages '
+             '(regular AND digests)?'),

 	    ('host_name', mm_cfg.Host, WIDTH, 0,
              'Host name this list prefers.',
diff -ur mailman-2.0.2-org/Mailman/Version.py mailman-2.0.2-patched/Mailman/Version.py
--- mailman-2.0.2-org/Mailman/Version.py	Sat Mar  3 07:19:15 2001
+++ mailman-2.0.2-patched/Mailman/Version.py	Thu Apr  5 07:39:08 2001
@@ -36,7 +36,7 @@
                (REL_LEVEL << 4)  | (REL_SERIAL << 0))

 # config.db schema version number
-DATA_FILE_VERSION = 21
+DATA_FILE_VERSION = 22

 # qfile/*.db schema version number
 QFILE_SCHEMA_VERSION = 2
diff -ur mailman-2.0.2-org/Mailman/versions.py mailman-2.0.2-patched/Mailman/versions.py
--- mailman-2.0.2-org/Mailman/versions.py	Wed Jun 14 07:09:58 2000
+++ mailman-2.0.2-patched/Mailman/versions.py	Thu Apr  5 06:59:08 2001
@@ -189,6 +189,7 @@
     add_only_if_missing('postings_responses', {}, l)
     add_only_if_missing('admin_responses', {}, l)
     add_only_if_missing('reply_goes_to_list', '', l)
+    add_only_if_missing('addlistinfo', mm_cfg.DEFAULT_ADDLISTINFO, l)