diff options
author | tkikuchi <> | 2004-10-10 13:22:25 +0000 |
---|---|---|
committer | tkikuchi <> | 2004-10-10 13:22:25 +0000 |
commit | 47f6f701f30af67bbef7a31452ccc21268834157 (patch) | |
tree | 802c83e9dca911410c98c0bcbac855f99b33749c | |
parent | 9892299e4618d54da33b7243568bcd3975e71c93 (diff) | |
download | mailman2-47f6f701f30af67bbef7a31452ccc21268834157.tar.gz mailman2-47f6f701f30af67bbef7a31452ccc21268834157.tar.xz mailman2-47f6f701f30af67bbef7a31452ccc21268834157.zip |
I18N error avoidance. HeaderParserError/UnicodeError
-rw-r--r-- | Mailman/Archiver/HyperArch.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Mailman/Archiver/HyperArch.py b/Mailman/Archiver/HyperArch.py index 64a2d006..ca597c72 100644 --- a/Mailman/Archiver/HyperArch.py +++ b/Mailman/Archiver/HyperArch.py @@ -40,6 +40,7 @@ import weakref import binascii from email.Header import decode_header, make_header +from email.Errors import HeaderParseError from Mailman import mm_cfg from Mailman import Utils @@ -407,7 +408,10 @@ class Article(pipermail.Article): if field.find("=?") == -1: return None # Get the decoded header as a list of (s, charset) tuples - pairs = decode_header(field) + try: + pairs = decode_header(field) + except HeaderParseError: + return None # Use __unicode__() until we can guarantee Python 2.2 try: # Use a large number for maxlinelen so it won't get wrapped @@ -1003,7 +1007,11 @@ class HyperArchive(pipermail.T): subject = self.get_header("subject", article) author = self.get_header("author", article) if mm_cfg.ARCHIVER_OBSCURES_EMAILADDRS: - author = re.sub('@', _(' at '), author) + try: + author = re.sub('@', _(' at '), author) + except UnicodeError: + # Non-ASCII author contains '@' ... no valid email anyway + pass subject = CGIescape(subject, self.lang) author = CGIescape(author, self.lang) |