From cdbdb51c6073647027036f49fe54b9d2bc510a46 Mon Sep 17 00:00:00 2001 From: klm Date: Tue, 14 Apr 1998 17:12:17 +0000 Subject: (First checkin after release tagged mailman-1_0b2.) Changed digest header format slightly, but changed the code more to use keyword format strings instead of order-dependent ones, to make reorganizing the text a lot less fragile. (I'm coming to think that having a footer is mostly undesirable, so mm_cfg.DEFAULT_DIGEST_FOOTER should be the empty string.) --- Mailman/Digester.py | 63 +++++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 29 deletions(-) (limited to 'Mailman/Digester.py') diff --git a/Mailman/Digester.py b/Mailman/Digester.py index 8413ae2a3..dbf66a680 100644 --- a/Mailman/Digester.py +++ b/Mailman/Digester.py @@ -1,6 +1,6 @@ """Mixin class with list-digest handling methods and settings.""" -__version__ = "$Revision: 445 $" +__version__ = "$Revision: 455 $" import mm_utils, mm_err, mm_message, mm_cfg import time, os, string @@ -172,53 +172,58 @@ class Digester: digest_file = open(os.path.join(self._full_path, 'next-digest'), 'r+') msg.SetBody(digest_file.read()) - # Create the header and footer... this is a mess! + # Create the header and footer... a bit messy. topics_file = open(os.path.join(self._full_path, 'next-digest-topics'), 'r+') topics_text = topics_file.read() topics_number = string.count(topics_text, '\n') - digest_header = '''--%s + subst = {} + for k, v in self.__dict__.items(): + subst[k] = v + subst['_mime_separator'] = self._mime_separator + subst.update({'got_sender': msg.GetSender(), + 'got_listinfo_url': self.GetScriptURL('listinfo'), + 'got_request_email': self.GetRequestEmail(), + 'got_date': time.ctime(time.time()), + 'got_list_email': self.GetListEmail(), + 'got_topics_text': topics_text}) -From: %s -Subject: Contents of %s digest, Volume %d #%d -Date: %s + digest_header = '''--%(_mime_separator)s -When replying, please edit your Subject line so it is more specific than -"Re: Contents of %s digest..." +From: %(got_sender)s +Subject: Contents of %(real_name)s digest, Volume %(volume)d #%(next_digest_number)d +Date: %(got_date)s + +Send %(real_name)s maillist submissions to + %(got_list_email)s -Send %s maillist submissions to - %s To subscribe or unsubscribe via the web, visit - %s -or send email to %s + %(got_listinfo_url)s +or send email to %(got_request_email)s + +(When replying, please edit your Subject line so it is more specific than +"Re: Contents of %(real_name)s digest...") Topics for this digest: -%s -''' % (self._mime_separator, - msg.GetSender(), - self.real_name, self.volume, self.next_digest_number, - time.ctime(time.time()), - self.real_name, self.GetListEmail(), - self.real_name, - self.GetScriptURL('listinfo'), - self.GetRequestEmail(), - topics_text) +%(got_topics_text)s +''' % subst if self.digest_header: digest_header = digest_header + (self.digest_header % self.__dict__) if self.digest_footer: - digest_footer = '''--%s + subst['got_footer'] = self.digest_footer % self.__dict__ + + digest_footer = '''--%(_mime_separator)s -From: %s -Subject: Digest Footer -Date: %s +From: %(got_sender)s +Subject: %(real_name)s V%(volume)s#%(next_digest_number)s Digest Footer +Date: %(got_date)s -%s ---%s--''' % (self._mime_separator, msg.GetSender(), time.ctime(time.time()), - (self.digest_footer % self.__dict__), self._mime_separator) +%(got_footer)s +--%(_mime_separator)s--''' % subst else: digest_footer = ''' --%s--''' % self._mime_separator -- cgit v1.2.3-70-g09d2