diff options
| author | mailman | 1998-03-20 17:59:51 +0000 |
|---|---|---|
| committer | mailman | 1998-03-20 17:59:51 +0000 |
| commit | cbaf655c487515bf43ffd203c19225d1d460c138 (patch) | |
| tree | f405ca33dfb45b31f846e4476a92289910feb774 /Mailman/Deliverer.py | |
| parent | bee5eb485b0584ea4dd9df29c767d4deeaa694e8 (diff) | |
| download | mailman-cbaf655c487515bf43ffd203c19225d1d460c138.tar.gz mailman-cbaf655c487515bf43ffd203c19225d1d460c138.tar.zst mailman-cbaf655c487515bf43ffd203c19225d1d460c138.zip | |
This is the fix i mentioned in my last checkin (not mm_digest).
Use a python-lib tempfile, instead of ginning one up distinguised by
pid. The problem with the old method is that the same process - eg,
senddigest - may be cycling through many lists, which means that all
the lists would use the same tempfile name. And deliver, having
opened the file for reading, would get it pulled out from under it
when, eg, senddigest got to having mm_deliver prepare digest for the
next list. tempfile.mktemp() specifically finds a filename that is
not in use.
I'm leaving in commented-out text for some special membership-
migration notices, for use later today or tomorrow, when i move over
the rest of the lists.
Diffstat (limited to 'Mailman/Deliverer.py')
| -rw-r--r-- | Mailman/Deliverer.py | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/Mailman/Deliverer.py b/Mailman/Deliverer.py index 53d2056dc..e37e74a56 100644 --- a/Mailman/Deliverer.py +++ b/Mailman/Deliverer.py @@ -1,4 +1,4 @@ -import string, os, sys +import string, os, sys, tempfile import mm_cfg, mm_message, mm_err # Text for various messages: @@ -10,6 +10,16 @@ Your message entitled: was successfully received by %s. ''' +## CHANGETEXT = '''[PSA SIG maillist member: Your mailing list is being migrated to a new +## maillist mechanism which offers more control both to the list members and +## to the administrator. Info about getting at the new features is detailed +## below. We will be switching over to the new list immediately after the +## subscriptions are transferred, and besides this message (and barring +## unforseen bugs^H^H^H^H circumstances), the changeover should be fairly +## transparent. Bon voyage! Ken Manheimer, klm@python.org.] + +## ''' + SUBSCRIBEACKTEXT = '''Welcome to the %s@%s mailing list! If you ever want to unsubscribe or change your options (eg, switch to @@ -104,26 +114,29 @@ class Deliverer: if not(len(recipients)): return to_list = string.join(recipients) + tempfile.tempdir = '/tmp' + +## If this is a digest, or we ask to remove them, +## Remove old To: headers. We're going to stick our own in there. +## Also skip: Sender, return-receipt-to, errors-to, return-path, reply-to, +## (precedence, and received). -# If this is a digest, or we ask to remove them, -# Remove old To: headers. We're going to stick our own in there. -# Also skip: Sender, return-receipt-to, errors-to, return-path, reply-to, -# (precidence, and received). if remove_to: # Writing to a file is better than waiting for sendmail to exit - tmp_file_name = '/tmp/%smailman.%d.digest' % (tmpfile_prefix, - os.getpid()) + tempfile.template = tmpfile_prefix +'mailman-digest.' for item in msg.headers: if (item[0:3] == 'To:' or item[0:5] == 'X-To:'): msg.headers.remove(item) msg.headers.append('To: %s\n' % self.GetListEmail()) - else: - tmp_file_name = '/tmp/%smailman.%d' % (tmpfile_prefix, os.getpid()) + else: + tempfile.template = tmpfile_prefix + 'mailman.' msg.headers.append('Errors-To: %s\n' % self.GetAdminEmail()) - tmp_file = open(tmp_file_name, 'w+') - tmp_file.write(string.join(msg.headers,'')) + tmp_file_name = tempfile.mktemp() + tmp_file = open(tmp_file_name, 'w+') + + tmp_file.write(string.join(msg.headers,'')) # If replys don't go to the list, then they should go to the # real sender if self.reply_goes_to_list: @@ -161,13 +174,15 @@ class Deliverer: header = '' welcome = '' - body = SUBSCRIBEACKTEXT % (self.real_name, self.host_name, +## body = (CHANGETEXT + +## SUBSCRIBEACKTEXT % (self.real_name, self.host_name, + body = (SUBSCRIBEACKTEXT % (self.real_name, self.host_name, self.GetScriptURL('listinfo'), self.real_name, self.host_name, password, self.GetListEmail(), header, - welcome) + welcome)) self.SendTextToUser(subject = 'Welcome To "%s"! %s' % (self.real_name, digest_mode), |
