Update of /cvsroot/mailman/mailman/Mailman/Archiver
In directory sc8-pr-cvs1:/tmp/cvs-serv13361/Mailman/Archiver

Modified Files:
      Tag: Release_2_1-maint
        Archiver.py 
Log Message:
makelink(), breaklink(): Some coding updates.

InitVars(): Fix the permissions on the empty archive index.  Fixes SF bug
#835012.

CheckHTMLArchiveDir(): Only make the mbox link public if PUBLIC_MBOX is true.


Index: Archiver.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Archiver/Archiver.py,v
retrieving revision 2.28.2.1
retrieving revision 2.28.2.2
diff -u -d -r2.28.2.1 -r2.28.2.2
--- Archiver.py 22 Sep 2003 02:40:51 -0000      2.28.2.1
+++ Archiver.py 1 Dec 2003 01:07:26 -0000       2.28.2.2
@@ -35,22 +35,26 @@
 from Mailman.Logging.Syslog import syslog
 from Mailman.i18n import _
 
+try:
+    True, False
+except NameError:
+    True = 1
+    False = 0
+
 
 
 def makelink(old, new):
     try:
         os.symlink(old, new)
-    except os.error, e:
-        code, msg = e
-        if code <> errno.EEXIST:
+    except OSError, e:
+        if e.errno <> errno.EEXIST:
             raise
 
 def breaklink(link):
     try:
         os.unlink(link)
-    except os.error, e:
-        code, msg = e
-        if code <> errno.ENOENT:
+    except OSError, e:
+        if e.errno <> errno.ENOENT:
             raise
 
 
@@ -107,13 +111,16 @@
                 fp = open(indexfile)
             except IOError, e:
                 if e.errno <> errno.ENOENT: raise
-                else:
+                omask = os.umask(002)
+                try:
                     fp = open(indexfile, 'w')
-                    fp.write(Utils.maketext(
-                        'emptyarchive.html',
-                        {'listname': self.real_name,
-                         'listinfo': self.GetScriptURL('listinfo', absolute=1),
-                         }, mlist=self))
+                finally:
+                    os.umask(omask)
+                fp.write(Utils.maketext(
+                    'emptyarchive.html',
+                    {'listname': self.real_name,
+                     'listinfo': self.GetScriptURL('listinfo', absolute=1),
+                     }, mlist=self))
             if fp:
                 fp.close()
         finally:
@@ -220,7 +227,7 @@
         if mm_cfg.ARCHIVE_TO_MBOX == -1:
             # Archiving is completely disabled, don't require the skeleton.
             return
-        pubdir = Site.get_archpath(self.internal_name(), public=1)
+        pubdir = Site.get_archpath(self.internal_name(), public=True)
         privdir = self.archive_dir()
         pubmbox = pubdir + '.mbox'
         privmbox = privdir + '.mbox'
@@ -231,4 +238,6 @@
             # BAW: privdir or privmbox could be nonexistant.  We'd get an
             # OSError, ENOENT which should be caught and reported properly.
             makelink(privdir, pubdir)
-            makelink(privmbox, pubmbox)
+            # Only make this link if the site has enabled public mbox files
+            if mm_cfg.PUBLIC_MBOX:
+                makelink(privmbox, pubmbox)



_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
Unsubscribe: http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to