[Mailman-Developers] Patch: newlist in mailman cvs

Marc MERLIN marc_news@valinux.com
Mon, 10 Dec 2001 01:19:07 -0800


There are two changes here:
The first  one is to introduce  a hook to  fail list creations if  some test
doesn't succeed.
It might  be better to  roll than  in the current  MTA module as  a separate
option method, I just couldn't find how to test for the presence of a method
in a class
Why   do   I   need   this? On   my    systems   at   VA,   I   check   that
listname@lists.vasoftware.com doesn't conflict with an existing
listname@vasoftware.com
More explicitely, I do this:
    if Utils.list_exists(listname):
        usage(1, 'List already exists: ' + listname)

    fd=os.popen("expn " + listname + "@valinux.com")
    file=fd.read()

    tofind=re.compile("USER UNKNOWN")
    if not tofind.search(file):
        print "mail.valinux.com already has an email matching " + listname + "@v
alinux.com"
        sys.exit()


The second addition simply creates an empty dir for pipermail so that people
stop telling me that the list archive link is broken when the list is empty.

--- newlist.mailman	Sun Dec  9 21:10:39 2001
+++ newlist	Sun Dec  9 22:32:24 2001
@@ -130,6 +130,12 @@
     listpasswd = listpasswd.strip()
     if not listpasswd:
         usage(1, _('The list password cannot be empty'))
+	
+    # Allow for check and a possible reject before the list is created.
+    if mm_cfg.MTA_PRECHECK:
+        modname = 'Mailman.MTA.' + mm_cfg.MTA_PRECHECK
+        __import__(modname)
+        sys.modules[modname].create(mlist)
 
     mlist = MailList.MailList()
     try:
@@ -162,6 +168,12 @@
         modname = 'Mailman.MTA.' + mm_cfg.MTA
         __import__(modname)
         sys.modules[modname].create(mlist)
+
+    # Create an empty directory for pipermail (stops the URL not found when
+    # you try to view the archives of a list that hasn't had posts yet)
+    dirpath = paths.prefix + '/archives/private/' + listname
+    os.mkdir(dirpath)
+    os.chmod(dirpath, 02775)
 
     # And send the notice to the list owner
     if not quiet:

Marc
-- 
Microsoft is to operating systems & security ....
                                      .... what McDonalds is to gourmet cooking
  
Home page: http://marc.merlins.org/   |   Finger marc_f@merlins.org for PGP key