diff options
author | bwarsaw <> | 2003-12-26 20:41:30 +0000 |
---|---|---|
committer | bwarsaw <> | 2003-12-26 20:41:30 +0000 |
commit | e423e0918e84332463a26a7ec70f9b944f2ec8b8 (patch) | |
tree | 9ef3a8ed0b5f3c27b9e1a9235670610ca92b8915 | |
parent | b4875c6fb7f3990b3c280e585188bc88fe1d7301 (diff) | |
download | mailman2-e423e0918e84332463a26a7ec70f9b944f2ec8b8.tar.gz mailman2-e423e0918e84332463a26a7ec70f9b944f2ec8b8.tar.xz mailman2-e423e0918e84332463a26a7ec70f9b944f2ec8b8.zip |
Article.__init__(): Provide a default charset if the message doesn't
have one. Part of TK's patch #865661.
__processbody_URLquote(): One chunk of TK's patch # 865661 for
improving the i18n of the 'at' substitutions for archives.
-rw-r--r-- | Mailman/Archiver/HyperArch.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Mailman/Archiver/HyperArch.py b/Mailman/Archiver/HyperArch.py index e922b020..64a2d006 100644 --- a/Mailman/Archiver/HyperArch.py +++ b/Mailman/Archiver/HyperArch.py @@ -287,7 +287,7 @@ class Article(pipermail.Article): self.ctype = ctype.lower() self.cenc = cenc.lower() self.decoded = {} - charset = message.get_param('charset') + charset = message.get_param('charset', 'us-ascii') if isinstance(charset, types.TupleType): # An RFC 2231 charset charset = unicode(charset[2], charset[0]) @@ -298,7 +298,7 @@ class Article(pipermail.Article): if charset[0]=="'" and charset[-1]=="'": charset = charset[1:-1] try: - body = message.get_payload(decode=1) + body = message.get_payload(decode=True) except binascii.Error: body = None if body and charset != Utils.GetCharSet(self._lang): @@ -1128,6 +1128,10 @@ class HyperArchive(pipermail.T): # 1. use lines directly, rather than source and dest # 2. make it clearer # 3. make it faster + # TK: Prepare for unicode obscure. + atmark = _(' at ') + if lines and isinstance(lines[0], types.UnicodeType): + atmark = unicode(atmark, Utils.GetCharSet(self.lang), 'replace') source = lines[:] dest = lines last_line_was_quoted = 0 @@ -1168,7 +1172,7 @@ class HyperArchive(pipermail.T): text = jr.group(1) length = len(text) if mm_cfg.ARCHIVER_OBSCURES_EMAILADDRS: - text = re.sub('@', _(' at '), text) + text = re.sub('@', atmark, text) URL = self.maillist.GetScriptURL( 'listinfo', absolute=1) else: |