From 200ca2ebc9e16cd38c0aaecfe9f1a10333ead8c2 Mon Sep 17 00:00:00 2001 From: bwarsaw <> Date: Sat, 27 Dec 2003 00:56:44 +0000 Subject: show_helds_overview(), show_post_requests(): Another part of TK's patch # 865661. Encode the subject header in the list's preferred character set and make sure it is all on one line. --- Mailman/Cgi/admindb.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Mailman/Cgi/admindb.py b/Mailman/Cgi/admindb.py index abafacca..d8092415 100644 --- a/Mailman/Cgi/admindb.py +++ b/Mailman/Cgi/admindb.py @@ -470,10 +470,12 @@ def show_helds_overview(mlist, form): # handled by the time we got here. mlist.HandleRequest(id, mm_cfg.DISCARD) continue + dispsubj = Utils.oneline( + subject, Utils.GetCharSet(mlist.preferred_language)) t = Table(border=0) t.AddRow([Link(admindburl + '?msgid=%d' % id, '[%d]' % counter), Bold(_('Subject:')), - Utils.websafe(subject) + Utils.websafe(dispsubj) ]) t.AddRow([' ', Bold(_('Size:')), str(size) + _(' bytes')]) if reason: @@ -589,6 +591,14 @@ def show_post_requests(mlist, id, info, total, count, form): body = EMPTYSTRING.join(lines)[:mm_cfg.ADMINDB_PAGE_TEXT_LIMIT] else: body = EMPTYSTRING.join(lines) + # Get message charset and try encode in list charset + mcset = msg.get_param('charset', 'us-ascii').lower() + lcset = Utils.GetCharSet(mlist.preferred_language) + if mcset <> lcset: + try: + body = unicode(body, mcset).encode(lcset) + except (LookupError, UnicodeError): + pass hdrtxt = NL.join(['%s: %s' % (k, v) for k, v in msg.items()]) hdrtxt = Utils.websafe(hdrtxt) # Okay, we've reconstituted the message just fine. Now for the fun part! @@ -596,7 +606,8 @@ def show_post_requests(mlist, id, info, total, count, form): t.AddRow([Bold(_('From:')), sender]) row, col = t.GetCurrentRowIndex(), t.GetCurrentCellIndex() t.AddCellInfo(row, col-1, align='right') - t.AddRow([Bold(_('Subject:')), Utils.websafe(subject)]) + t.AddRow([Bold(_('Subject:')), + Utils.websafe(Utils.oneline(subject, lcset))]) t.AddCellInfo(row+1, col-1, align='right') t.AddRow([Bold(_('Reason:')), _(reason)]) t.AddCellInfo(row+2, col-1, align='right') -- cgit v1.2.3