diff options
author | bwarsaw <> | 2003-12-01 01:07:26 +0000 |
---|---|---|
committer | bwarsaw <> | 2003-12-01 01:07:26 +0000 |
commit | f482383dc853c12a8ec78b848fb83f548609ea61 (patch) | |
tree | 6a188772a47997260c4ea039cc467b0531ec9a9e /Mailman | |
parent | a3ba4e0c816ce2fd0a9eeae72f05b4dfdcad40fb (diff) | |
download | mailman2-f482383dc853c12a8ec78b848fb83f548609ea61.tar.gz mailman2-f482383dc853c12a8ec78b848fb83f548609ea61.tar.xz mailman2-f482383dc853c12a8ec78b848fb83f548609ea61.zip |
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.
Diffstat (limited to 'Mailman')
-rw-r--r-- | Mailman/Archiver/Archiver.py | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/Mailman/Archiver/Archiver.py b/Mailman/Archiver/Archiver.py index 8c41f0f8..5c55d697 100644 --- a/Mailman/Archiver/Archiver.py +++ b/Mailman/Archiver/Archiver.py @@ -35,22 +35,26 @@ from Mailman.SafeDict import SafeDict 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 @@ class Archiver: 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 @@ class Archiver: 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 @@ class Archiver: # 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) |