aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2018-06-22 08:36:36 -0700
committerMark Sapiro <mark@msapiro.net>2018-06-22 08:36:36 -0700
commit594de91c05384ab6136adfcc9db68f97af3a9d89 (patch)
tree35cbccf142e90c0a11f5e52ab64fb94b35db51b1 /Mailman
parent388b4a41ece74d11298e640429bef5f903221d09 (diff)
parentfe5ed76b93d5d8e727a2f04e831794ab6db659c8 (diff)
downloadmailman2-594de91c05384ab6136adfcc9db68f97af3a9d89.tar.gz
mailman2-594de91c05384ab6136adfcc9db68f97af3a9d89.tar.xz
mailman2-594de91c05384ab6136adfcc9db68f97af3a9d89.zip
Fixed garbled descriptions on admin and listinfo pages.
Diffstat (limited to 'Mailman')
-rw-r--r--Mailman/Cgi/admin.py2
-rw-r--r--Mailman/Cgi/listinfo.py2
-rw-r--r--Mailman/HTMLFormatter.py7
-rw-r--r--Mailman/MailList.py21
4 files changed, 29 insertions, 3 deletions
diff --git a/Mailman/Cgi/admin.py b/Mailman/Cgi/admin.py
index f77b358e..a92ab378 100644
--- a/Mailman/Cgi/admin.py
+++ b/Mailman/Cgi/admin.py
@@ -295,7 +295,7 @@ def admin_overview(msg=''):
else:
advertised.append((mlist.GetScriptURL('admin'),
mlist.real_name,
- mlist.description))
+ Utils.websafe(mlist.GetDescription())))
# Greeting depends on whether there was an error or not
if msg:
greeting = FontAttr(msg, color="ff5060", size="+1")
diff --git a/Mailman/Cgi/listinfo.py b/Mailman/Cgi/listinfo.py
index b55c263d..f1b455da 100644
--- a/Mailman/Cgi/listinfo.py
+++ b/Mailman/Cgi/listinfo.py
@@ -114,7 +114,7 @@ def listinfo_overview(msg=''):
else:
advertised.append((mlist.GetScriptURL('listinfo'),
mlist.real_name,
- Utils.websafe(mlist.description)))
+ Utils.websafe(mlist.GetDescription())))
if msg:
greeting = FontAttr(msg, color="ff5060", size="+1")
else:
diff --git a/Mailman/HTMLFormatter.py b/Mailman/HTMLFormatter.py
index 93686899..098a2881 100644
--- a/Mailman/HTMLFormatter.py
+++ b/Mailman/HTMLFormatter.py
@@ -389,11 +389,16 @@ class HTMLFormatter:
listlangs = _(Utils.GetLanguageDescr(self.preferred_language))
else:
listlangs = self.GetLangSelectBox(lang).Format()
+ if lang:
+ cset = Utils.GetCharSet(lang) or 'us-ascii'
+ else:
+ cset = Utils.GetCharSet(self.preferred_language) or 'us-ascii'
d = {
'<mm-mailman-footer>' : self.GetMailmanFooter(),
'<mm-list-name>' : self.real_name,
'<mm-email-user>' : self._internal_name,
- '<mm-list-description>' : Utils.websafe(self.description),
+ '<mm-list-description>' :
+ Utils.websafe(self.GetDescription(cset)),
'<mm-list-info>' :
'<!---->' + BR.join(self.info.split(NL)) + '<!---->',
'<mm-form-end>' : self.FormatFormEnd(),
diff --git a/Mailman/MailList.py b/Mailman/MailList.py
index 83717f40..8e2518c5 100644
--- a/Mailman/MailList.py
+++ b/Mailman/MailList.py
@@ -262,6 +262,27 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
user = Utils.ObscureEmail(user)
return '%s/%s' % (url, urllib.quote(user.lower()))
+ def GetDescription(self, cset=None, errors='xmlcharrefreplace'):
+ # Get list's description in charset specified by cset.
+ # If cset is None, it uses charset of context language.
+ mcset = Utils.GetCharSet(self.preferred_language)
+ if cset is None:
+ # translation context may not be initialized
+ trns = i18n.get_translation()
+ if trns is None:
+ ccset = 'us-ascii'
+ else:
+ ccset = i18n.get_translation().charset() or 'us-ascii'
+ else:
+ ccset = cset
+ if isinstance(self.description, unicode):
+ return self.description.encode(ccset, errors)
+ if mcset == ccset:
+ return self.description
+ return Utils.xml_to_unicode(self.description, mcset).encode(ccset,
+ errors)
+
+
#
# Instance and subcomponent initialization