diff options
| -rw-r--r-- | Mailman/Handlers/Decorate.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Mailman/Handlers/Decorate.py b/Mailman/Handlers/Decorate.py index 122da2ff0..4f364b864 100644 --- a/Mailman/Handlers/Decorate.py +++ b/Mailman/Handlers/Decorate.py @@ -17,9 +17,11 @@ """Decorate a message by sticking the header and footer around it. """ +import string + from Mailman import mm_cfg from Mailman import Utils -import string +from Mailman.Logging.Syslog import syslog @@ -27,6 +29,14 @@ def process(mlist, msg, msgdata): d = Utils.SafeDict(mlist.__dict__) d['cgiext'] = mm_cfg.CGIEXT # interpolate into the header - header = string.replace(mlist.msg_header % d, '\r\n', '\n') - footer = string.replace(mlist.msg_footer % d, '\r\n', '\n') + try: + header = string.replace(mlist.msg_header % d, '\r\n', '\n') + except ValueError, e: + syslog('error', 'Exception while calculating message header:\n%s' % e) + header = '[INVALID HEADER]' + try: + footer = string.replace(mlist.msg_footer % d, '\r\n', '\n') + except ValueError, e: + syslog('error', 'Exception while calculating message footer:\n%s' % e) + footer = '[INVALID FOOTER]' msg.body = header + msg.body + footer |
