summaryrefslogtreecommitdiff
path: root/Mailman/Archiver/HyperArch.py
diff options
context:
space:
mode:
authorbwarsaw2000-10-03 21:20:41 +0000
committerbwarsaw2000-10-03 21:20:41 +0000
commit06395bf773a88982d83f261d66314e28164a4acc (patch)
tree59e8966bd529e34370ca0a4d93a80cdfd7509285 /Mailman/Archiver/HyperArch.py
parentc80a00198e0fd00832c3cff31d498fd01878e07a (diff)
downloadmailman-06395bf773a88982d83f261d66314e28164a4acc.tar.gz
mailman-06395bf773a88982d83f261d66314e28164a4acc.tar.zst
mailman-06395bf773a88982d83f261d66314e28164a4acc.zip
article_text_template: Get rid of this, we're going to do things
differently. class Article(): Get rid of text_tmpl for the same reason. as_text(): We need to retain In-Reply-To:, References:, and Message-ID: if the downloadable periodics are to be at all threadable. Suggested by Gerald Oskoboiny. Also, get something reasonable defaults for Date: header if the original message is missing it (i.e. "None" isn't reasonable :).
Diffstat (limited to '')
-rw-r--r--Mailman/Archiver/HyperArch.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/Mailman/Archiver/HyperArch.py b/Mailman/Archiver/HyperArch.py
index 46d77749d..09839a298 100644
--- a/Mailman/Archiver/HyperArch.py
+++ b/Mailman/Archiver/HyperArch.py
@@ -81,16 +81,6 @@ def sizeof(filename):
return ' %d MB ' % (size / 1000000)
-article_text_template="""\
-From %(email)s %(fromdate)s
-Date: %(datestr)s
-From: %(email)s (%(author)s)
-Subject: %(subject)s
-
-%(body)s
-
-"""
-
article_template='''\
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
@@ -201,7 +191,6 @@ class Article(pipermail.Article):
_last_article_time = time.time()
html_tmpl = article_template
- text_tmpl = article_text_template
# for compatibility with old archives loaded via pickle
charset = mm_cfg.DEFAULT_CHARSET
@@ -394,12 +383,26 @@ class Article(pipermail.Article):
d = self.__dict__.copy()
# We need to guarantee a valid From_ line, even if there are
# bososities in the headers.
- if not string.strip(d.get('fromdate')):
+ if not string.strip(d.get('fromdate', '')):
d['fromdate'] = time.ctime(time.time())
- if not string.strip(d.get('email')):
+ if not string.strip(d.get('email', '')):
d['email'] = 'bogus@does.not.exist.com'
- d['body'] = string.join(self.body, '')
- return self.text_tmpl % d
+ if not string.strip(d.get('datestr', '')):
+ d['datestr'] = time.ctime(time.time())
+ #
+ headers = ['From %(email)s %(fromdate)s',
+ 'From: %(email)s (%(author)s)',
+ 'Date: %(datestr)s',
+ 'Subject: %(subject)s']
+ if d['_in_reply_to']:
+ headers.append('In-Reply-To: %(_in_reply_to)s')
+ if d['_references']:
+ headers.append('References: %(_references)s')
+ if d['_message_id']:
+ headers.append('Message-ID: %(_message_id)s')
+ return string.join(headers, '\n') % d + \
+ '\n\n' + \
+ string.join(self.body, '')
def _set_date(self, message):
self.__super_set_date(message)