[Mailman-Developers] External Archiving Patch

Paul Hebble Paul Hebble <hebble@ncsa.uiuc.edu>
Wed, 4 Aug 1999 10:35:48 -0500 (CDT)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

---559023410-851401618-933780948=:22090
Content-Type: TEXT/PLAIN; charset=US-ASCII

Hi all,

This patch should let the administrator specify alternative external
archivers.  All you have to do is set the PUBLIC_EXTERNAL_ARCHIVER and/or
PRIVATE_EXTERNAL_ARCHIVER variables to the command line you wish to use.  If
you put "$LISTNAME" or "${LISTNAME}" in the command line, it is replaced
with the name of the list.  Mailman will run the command line and pipe each
post to it.

The main advantage to this is that all post filtering is done without
having to subscribe a procmailrc to the list.  This prevents list-admins
from accidentally unsubscribing the archiver.

If the variables given above are set to "" (the default), Mailman will fall
back to the built-in Pipermail archiver, so this should not break any
existing installations.

My apologies for using regsub, but I have not been able to find enough
documentation on the re module.  Perhaps someone better acquainted with it
could migrate this patch to it?

--
	Paul Hebble <hebble@ncsa.uiuc.edu>


-- BEGIN PATCH (Also attached in gzip format)

diff -Nru --exclude=CVS --exclude=Makefile --exclude=crontab.in --exclude=mm_cfg.py.dist --exclude=*.pyc --exclude=.*.tmp --exclude=config.* mailman/Mailman/Archiver/Archiver.py mailman-archiving/Mailman/Archiver/Archiver.py
--- mailman/Mailman/Archiver/Archiver.py	Thu Jul  1 13:59:51 1999
+++ mailman-archiving/Mailman/Archiver/Archiver.py	Tue Aug  3 09:46:14 1999
@@ -29,6 +29,7 @@
 import sys, os, string
 import errno
 from Mailman.Utils import reraise, mkdir
+import regsub
 
 #
 # package/project modules
@@ -174,6 +175,13 @@
             # Resurrect original date setting.
             post.SetHeader('Date', olddate)
 
+    def ExternalArchive(self, ar, txt):
+	regsub.gsub("\$LISTNAME\>", self.real_name, ar)
+	regsub.gsub("\${LISTNAME}", self.real_name, ar)
+	extarch = os.popen(ar, "w")
+	extarch.write(txt)
+	extarch.close()
+
     #
     # archiving in real time  this is called from list.post(msg)
     #
@@ -207,6 +215,16 @@
                     if line and line[:5] == 'From ':
                         line = '>' + line
                     txt = txt + "%s\n" % line
+		if not self.archive_private \
+		    and mm_cfg.PUBLIC_EXTERNAL_ARCHIVER is not "" and \
+		    mm_cfg.PUBLIC_EXTERNAL_ARCHIVER is not "pipermail":
+		    ExternalArchive(mm_cfg.PUBLIC_EXTERNAL_ARCHIVER, txt)
+		    os._exit(0)
+		if self.archive_private \
+		    and mm_cfg.PRIVATE_EXTERNAL_ARCHIVER is not "" and \
+		    mm_cfg.PRIVATE_EXTERNAL_ARCHIVER is not "pipermail":
+		    ExternalArchive(mm_cfg.PRIVATE_EXTERNAL_ARCHIVER, txt)
+		    os._exit(0)
                 f = StringIO(txt)
                 import HyperArch
                 h = HyperArch.HyperArchive(self)
diff -Nru --exclude=CVS --exclude=Makefile --exclude=crontab.in --exclude=mm_cfg.py.dist --exclude=*.pyc --exclude=.*.tmp --exclude=config.* mailman/Mailman/Defaults.py mailman-archiving/Mailman/Defaults.py
--- mailman/Mailman/Defaults.py	Wed Aug  4 10:16:26 1999
+++ mailman-archiving/Mailman/Defaults.py	Tue Aug  3 09:14:44 1999
@@ -62,6 +62,8 @@
 #
 DEFAULT_ARCHIVE_VOLUME_FREQUENCY = 1
 
+PUBLIC_EXTERNAL_ARCHIVER = ""
+PRIVATE_EXTERNAL_ARCHIVER = ""
 
 HOME_PAGE         = 'index.html'
 MAILMAN_OWNER     = 'mailman-owner@%s' % DEFAULT_HOST_NAME
diff -Nru --exclude=CVS --exclude=Makefile --exclude=crontab.in --exclude=mm_cfg.py.dist --exclude=*.pyc --exclude=.*.tmp --exclude=config.* mailman/Mailman/Defaults.py.in mailman-archiving/Mailman/Defaults.py.in
--- mailman/Mailman/Defaults.py.in	Mon Aug  2 11:42:20 1999
+++ mailman-archiving/Mailman/Defaults.py.in	Tue Aug  3 09:15:02 1999
@@ -62,6 +62,8 @@
 #
 DEFAULT_ARCHIVE_VOLUME_FREQUENCY = 1
 
+PUBLIC_EXTERNAL_ARCHIVER = ""
+PRIVATE_EXTERNAL_ARCHIVER = ""
 
 HOME_PAGE         = 'index.html'
 MAILMAN_OWNER     = 'mailman-owner@%s' % DEFAULT_HOST_NAME


---559023410-851401618-933780948=:22090
Content-Type: APPLICATION/octet-stream; name="patch-mailman.archiving.gz"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.SOL.3.95.990804103548.22090A@pecos.ncsa.uiuc.edu>
Content-Description: 

H4sICFNZqDcCA3BhdGNoLW1haWxtYW4uYXJjaGl2aW5nAN1VbW/iRhD+jH/F
yGkExODDBEixxAlf4hQqXq685Fo1leWz12Qbv2m9vhBV/e+dtTHyHeFCvrW1
YL2efWZ2ZufZGZd6HjRnLIVmk2wdP3XJ4PpuWfqa2o/Eoz4piRwWhdz+rNKw
JAwCy/E2avysujThpYULlDmlb/VC5UFcNheFHt2oFxDY1A/s8N109zaY80C/
ELafoKUC1LQzGQ0334VLzWbzJLuV1UMKP6c+gAbapd7t612c9Pt9SVGUN25a
WaUEjHQDcAmtvt7p6VontzUcQrPdb/RAwfEKhkMJaBBHjEPynDQgwn/CGdrf
ywljYSSBx6IAdnuqa079pAAwwmyakAYEjy5lkrIXb5L0swQSnOEPYtt5tDfk
XcyiP4nDIYjc1CdJ5pB21REeaVfdhnaZ+VR+zmBBkpQxoRUxuqGh7YNrcwIJ
4RxdVb/Gx1HC1SXhI2K7hNWqNwitYmi+K5Tq6JEiYC7xwNxywtDc7uhqCfG9
BtisAXzL67qkVPIoVDHU5PsfJuPlamZMzfv3Mh4UolVGbN8K7YAIvfqhxl+F
yt9HNciWi7TCAI9fjaOYhDXhgvwkl1bVJ0Y5qQm/SkLHjxJSQ0l+BGe7F+xp
AnhFxIbAaUAA+APFvCXg2L5P3DypPt4WVRxaLUg29cJQRpTWVcYUDfPSO8hL
8VAPTYQE7NDNJr/r3T9gMIDqrbBe1V/WEk+mhsD3VVCyj5ehGDOixKiAfJ7c
hzKc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