diff options
| author | Barry Warsaw | 2009-01-16 21:04:21 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2009-01-16 21:04:21 -0500 |
| commit | ae3d0cc316b826b8325507d960ccf84da601c3b0 (patch) | |
| tree | 3485e2ca463c2131a0ffb1693bc60d569cc9d8b7 /mailman/pipeline/decorate.py | |
| parent | a3f7d07c62b2f7d6ac9d0b700883826c2838db60 (diff) | |
| download | mailman-ae3d0cc316b826b8325507d960ccf84da601c3b0.tar.gz mailman-ae3d0cc316b826b8325507d960ccf84da601c3b0.tar.zst mailman-ae3d0cc316b826b8325507d960ccf84da601c3b0.zip | |
Diffstat (limited to 'mailman/pipeline/decorate.py')
| -rw-r--r-- | mailman/pipeline/decorate.py | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/mailman/pipeline/decorate.py b/mailman/pipeline/decorate.py index bf9fbea80..82851fbf1 100644 --- a/mailman/pipeline/decorate.py +++ b/mailman/pipeline/decorate.py @@ -17,15 +17,18 @@ """Decorate a message by sticking the header and footer around it.""" +from __future__ import absolute_import, unicode_literals + __metaclass__ = type -__all__ = ['Decorate'] +__all__ = [ + 'Decorate', + ] import re import logging from email.MIMEText import MIMEText -from string import Template from zope.interface import implements from mailman import Utils @@ -33,6 +36,7 @@ from mailman.Message import Message from mailman.config import config from mailman.i18n import _ from mailman.interfaces.handler import IHandler +from mailman.utilities.string import expand log = logging.getLogger('mailman.error') @@ -197,17 +201,18 @@ def decorate(mlist, template, extradict=None): # Create a dictionary which includes the default set of interpolation # variables allowed in headers and footers. These will be augmented by # any key/value pairs in the extradict. - d = dict(real_name = mlist.real_name, - list_name = mlist.list_name, - fqdn_listname = mlist.fqdn_listname, - host_name = mlist.host_name, - listinfo_page = mlist.script_url('listinfo'), - description = mlist.description, - info = mlist.info, - ) + substitutions = dict( + real_name = mlist.real_name, + list_name = mlist.list_name, + fqdn_listname = mlist.fqdn_listname, + host_name = mlist.host_name, + listinfo_page = mlist.script_url('listinfo'), + description = mlist.description, + info = mlist.info, + ) if extradict is not None: - d.update(extradict) - text = Template(template).safe_substitute(d) + substitutions.update(extradict) + text = expand(template, substitutions) # Turn any \r\n line endings into just \n return re.sub(r' *\r?\n', r'\n', text) |
