diff options
Diffstat (limited to 'Mailman/ListAdmin.py')
-rwxr-xr-x | Mailman/ListAdmin.py | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/Mailman/ListAdmin.py b/Mailman/ListAdmin.py index 13502352..877aa5c4 100755 --- a/Mailman/ListAdmin.py +++ b/Mailman/ListAdmin.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2011 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2014 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -101,7 +101,7 @@ class ListAdmin: # should we be as paranoid as for the config.pck file? Should we # use pickle? tmpfile = self.__filename + '.tmp' - omask = os.umask(002) + omask = os.umask(007) try: fp = open(tmpfile, 'w') try: @@ -194,7 +194,7 @@ class ListAdmin: else: ext = 'txt' filename = 'heldmsg-%s-%d.%s' % (self.internal_name(), id, ext) - omask = os.umask(002) + omask = os.umask(007) try: fp = open(os.path.join(mm_cfg.DATA_DIR, filename), 'w') try: @@ -243,7 +243,11 @@ class ListAdmin: if e.errno <> errno.ENOENT: raise return LOST try: - msg = cPickle.load(fp) + if path.endswith('.pck'): + msg = cPickle.load(fp) + else: + assert path.endswith('.txt'), '%s not .pck or .txt' % path + msg = fp.read() finally: fp.close() # Save the plain text to a .msg file, not a .pck file @@ -252,8 +256,11 @@ class ListAdmin: outpath = head + '.msg' outfp = open(outpath, 'w') try: - g = Generator(outfp) - g.flatten(msg, 1) + if path.endswith('.pck'): + g = Generator(outfp) + g.flatten(msg, 1) + else: + outfp.write(msg) finally: outfp.close() # Now handle updates to the database @@ -285,7 +292,8 @@ class ListAdmin: # message directly here can lead to a huge delay in web # turnaround. Log the moderation and add a header. msg['X-Mailman-Approved-At'] = email.Utils.formatdate(localtime=1) - syslog('vette', 'held message approved, message-id: %s', + syslog('vette', '%s: held message approved, message-id: %s', + self.internal_name(), msg.get('message-id', 'n/a')) # Stick the message back in the incoming queue for further # processing. @@ -403,8 +411,10 @@ class ListAdmin: }, mlist=self) # This message should appear to come from the <list>-owner so as # to avoid any useless bounce processing. - msg = Message.OwnerNotification(self, subject, text=text, - tomoderators=1) + owneraddr = self.GetOwnerEmail() + msg = Message.UserNotification(owneraddr, owneraddr, subject, text, + self.preferred_language) + msg.send(self, **{'tomoderators': 1}) # Restore the user's preferred language. i18n.set_language(lang) @@ -458,8 +468,10 @@ class ListAdmin: }, mlist=self) # This message should appear to come from the <list>-owner so as # to avoid any useless bounce processing. - msg = Message.OwnerNotification(self, subject, text=text, - tomoderators=1) + owneraddr = self.GetOwnerEmail() + msg = Message.UserNotification(owneraddr, owneraddr, subject, text, + self.preferred_language) + msg.send(self, **{'tomoderators': 1}) def __handleunsubscription(self, record, value, comment): addr = record |