summaryrefslogtreecommitdiff
path: root/Mailman/Utils.py
diff options
context:
space:
mode:
authortkikuchi2007-03-01 02:49:20 +0000
committertkikuchi2007-03-01 02:49:20 +0000
commitc08b190d0b31d09ef25a0e213b719ff337ac533c (patch)
treee04020252b8d0ff1e2c75dd73adbad8c23c9d6f3 /Mailman/Utils.py
parent8f9ab154c34e72223b4622052db2017d117cb489 (diff)
downloadmailman-c08b190d0b31d09ef25a0e213b719ff337ac533c.tar.gz
mailman-c08b190d0b31d09ef25a0e213b719ff337ac533c.tar.zst
mailman-c08b190d0b31d09ef25a0e213b719ff337ac533c.zip
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)