[Mailman-Developers] Patch: Optionally Suppressing List Headers

ps@psncc.at ps@psncc.at
Wed, 4 Apr 2001 23:11:54 +0200 (CEST)


Hi everybody,

I just produced the patch included below. It allows to configure not to
add the List-* header lines to outgoing non-digest messages. I needed this
to hide the HTTP URLs for the webinterface, as Mailman is used "just" as
the mailing list backend and the webinterface is to be used by the
administrators only.

A similar thing should probably be done for the digest case.

The patch should apply cleanly to 2.0.2 and 2.0.3.

Note that the patch adds a new attribute to the MailList object. This
usually breaks existing mailing lists.

You can fix the situation by creating a file <tempfile> with just the line

mlist.addlistinfo = 1

and using

<mailman-path>/bin/config_list -i <tempfile> <listname>


(at least this worked for me)

NOTE 1: Use this patch at your own risk.
NOTE 2: This is my first Mailman patch (and the first time I ever touched
python) so I may have overlooked some details.

Does anybody like this feature?


peter




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 22:19:24 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	Wed Apr  4 21:53:54 2001
@@ -345,6 +345,8 @@
 	self.msg_header = mm_cfg.DEFAULT_MSG_HEADER
 	self.msg_footer = mm_cfg.DEFAULT_MSG_FOOTER

+	self.addlistinfo = 1
+
     def GetConfigInfo(self):
 	config_info = {}
 	config_info['digest'] = Digester.GetConfigInfo(self)
@@ -770,6 +772,9 @@

              "Text appended to the bottom of every immediately-delivery"
              " message. " + Utils.maketext('headfoot.html', raw=1)),
+
+	    ('addlistinfo', mm_cfg.Toggle, ('No', 'Yes'), 1,
+	     'Add mailing list information headers to outgoing messages?'),
 	    ]

 	config_info['bounce'] = Bouncer.GetConfigInfo(self)