Update of /cvsroot/mailman/mailman/Mailman/Archiver
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14212
Modified Files:
Tag: Release_2_1-maint
HyperArch.py
Log Message:
Text file '@' obfuscation bug (unicode) fix. Thanks Mark.
Index: HyperArch.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Archiver/HyperArch.py,v
retrieving revision 2.37.2.19
retrieving revision 2.37.2.20
diff -u -d -r2.37.2.19 -r2.37.2.20
--- HyperArch.py 30 Dec 2005 18:50:07 -0000 2.37.2.19
+++ HyperArch.py 9 Jan 2006 07:33:36 -0000 2.37.2.20
@@ -569,16 +569,21 @@
if d['_message_id']:
headers.append('Message-ID: %(_message_id)s')
body = EMPTYSTRING.join(self.body)
- if isinstance(body, types.UnicodeType):
- body = body.encode(Utils.GetCharSet(self._lang), 'replace')
+ cset = Utils.GetCharSet(self._lang)
+ # Coerce the body to Unicode and replace any invalid characters.
+ if not isinstance(body, types.UnicodeType):
+ body = unicode(body, cset, 'replace')
if mm_cfg.ARCHIVER_OBSCURES_EMAILADDRS:
otrans = i18n.get_translation()
try:
+ atmark = unicode(_(' at '), cset)
i18n.set_language(self._lang)
body = re.sub(r'([-+,.\w]+)@([-+.\w]+)',
- '\g<1>' + _(' at ') + '\g<2>', body)
+ '\g<1>' + atmark + '\g<2>', body)
finally:
i18n.set_translation(otrans)
+ # Return body to character set of article.
+ body = body.encode(cset, 'replace')
return NL.join(headers) % d + '\n\n' + body + '\n'
def _set_date(self, message):
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org