diff options
author | Barry Warsaw <barry@python.org> | 2008-01-16 13:30:35 -0500 |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2008-01-16 13:30:35 -0500 |
commit | b9f58cac3640ef039f221263a3827e9c1751d9fe (patch) | |
tree | f4f50447a187527dea3592af680c0a69bccbdfa4 | |
parent | 491e5794fea450235f0bab35bcd4862e0d4195e9 (diff) | |
download | mailman2-b9f58cac3640ef039f221263a3827e9c1751d9fe.tar.gz mailman2-b9f58cac3640ef039f221263a3827e9c1751d9fe.tar.xz mailman2-b9f58cac3640ef039f221263a3827e9c1751d9fe.zip |
Allow us to pass in extra decoration (i.e. header/footer) data via the message
metadata. Specifically, if the metadata has a 'decoration-data' key, the
value should be a dictionary with extra interpolation keys.
Also fix a bug in the way the 'extradict' default value is passwed to
decorate. This should never be a mutable object.
-rw-r--r-- | Mailman/Handlers/Decorate.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Mailman/Handlers/Decorate.py b/Mailman/Handlers/Decorate.py index 4c00e34d..65037fbb 100644 --- a/Mailman/Handlers/Decorate.py +++ b/Mailman/Handlers/Decorate.py @@ -65,6 +65,7 @@ def process(mlist, msg, msgdata): except Errors.NotAMemberError: pass # These strings are descriptive for the log file and shouldn't be i18n'd + d.update(msgdata.get('decoration-data', {})) header = decorate(mlist, mlist.msg_header, 'non-digest header', d) footer = decorate(mlist, mlist.msg_footer, 'non-digest footer', d) # Escape hatch if both the footer and header are empty @@ -193,7 +194,7 @@ def process(mlist, msg, msgdata): -def decorate(mlist, template, what, extradict={}): +def decorate(mlist, template, what, extradict=None): # `what' is just a descriptive phrase used in the log message # # BAW: We've found too many situations where Python can be fooled into @@ -213,7 +214,8 @@ def decorate(mlist, template, what, extradict={}): 'info' : mlist.info, 'cgiext' : mm_cfg.CGIEXT, }) - d.update(extradict) + if extradict is not None: + d.update(extradict) # Using $-strings? if getattr(mlist, 'use_dollar_strings', 0): template = Utils.to_percent(template) |