summaryrefslogtreecommitdiff
path: root/Mailman/Utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mailman/Utils.py')
-rw-r--r--Mailman/Utils.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py
index 94a84532f..5844d708c 100644
--- a/Mailman/Utils.py
+++ b/Mailman/Utils.py
@@ -503,16 +503,12 @@ def findtext(templatefile, dict=None, raw=False, lang=None, mlist=None):
raise IOError(errno.ENOENT, 'No template file found', templatefile)
template = fp.read()
fp.close()
+ template = unicode(template, GetCharSet(lang), 'replace')
text = template
if dict is not None:
try:
- sdict = SafeDict(dict)
- try:
- text = sdict.interpolate(template)
- except UnicodeError:
- # Try again after coercing the template to unicode
- utemplate = unicode(template, GetCharSet(lang), 'replace')
- text = sdict.interpolate(utemplate)
+ sdict = SafeDict(dict, lang=lang)
+ text = sdict.interpolate(template)
except (TypeError, ValueError), e:
# The template is really screwed up
log.error('broken template: %s\n%s', filename, e)