summaryrefslogtreecommitdiff
path: root/mailman/Utils.py
diff options
context:
space:
mode:
authorBarry Warsaw2009-01-16 21:04:21 -0500
committerBarry Warsaw2009-01-16 21:04:21 -0500
commitae3d0cc316b826b8325507d960ccf84da601c3b0 (patch)
tree3485e2ca463c2131a0ffb1693bc60d569cc9d8b7 /mailman/Utils.py
parenta3f7d07c62b2f7d6ac9d0b700883826c2838db60 (diff)
downloadmailman-ae3d0cc316b826b8325507d960ccf84da601c3b0.tar.gz
mailman-ae3d0cc316b826b8325507d960ccf84da601c3b0.tar.zst
mailman-ae3d0cc316b826b8325507d960ccf84da601c3b0.zip
Diffstat (limited to 'mailman/Utils.py')
-rw-r--r--mailman/Utils.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/mailman/Utils.py b/mailman/Utils.py
index 26235d47d..10e201638 100644
--- a/mailman/Utils.py
+++ b/mailman/Utils.py
@@ -36,13 +36,14 @@ import email.Iterators
from email.Errors import HeaderParseError
from lazr.config import as_boolean
-from string import ascii_letters, digits, whitespace, Template
+from string import ascii_letters, digits, whitespace
import mailman.templates
from mailman import passwords
from mailman.config import config
from mailman.core import errors
+from mailman.utilities.string import expand
AT = '@'
@@ -418,7 +419,7 @@ def UnobscureEmail(addr):
class OuterExit(Exception):
pass
-def findtext(templatefile, dict=None, raw=False, lang=None, mlist=None):
+def findtext(templatefile, raw_dict=None, raw=False, lang=None, mlist=None):
# Make some text from a template file. The order of searches depends on
# whether mlist and lang are provided. Once the templatefile is found,
# string substitution is performed by interpolation in `dict'. If `raw'
@@ -524,12 +525,8 @@ def findtext(templatefile, dict=None, raw=False, lang=None, mlist=None):
fp.close()
template = unicode(template, GetCharSet(lang), 'replace')
text = template
- if dict is not None:
- try:
- text = Template(template).safe_substitute(**dict)
- except (TypeError, ValueError):
- # The template is really screwed up
- log.exception('broken template: %s', filename)
+ if raw_dict is not None:
+ text = expand(template, raw_dict)
if raw:
return text, filename
return wrap(text), filename