diff options
| author | bwarsaw | 2000-07-26 06:08:07 +0000 |
|---|---|---|
| committer | bwarsaw | 2000-07-26 06:08:07 +0000 |
| commit | 68dc55b4fcb2ea130ce3f8ecb5c261857e491e22 (patch) | |
| tree | 915f4eb3b5afe1f465807e6679ffa42a9b14d152 /Mailman | |
| parent | 0dc08d1b9629e7ebcc5acbab24eaf5466e369c14 (diff) | |
| download | mailman-68dc55b4fcb2ea130ce3f8ecb5c261857e491e22.tar.gz mailman-68dc55b4fcb2ea130ce3f8ecb5c261857e491e22.tar.zst mailman-68dc55b4fcb2ea130ce3f8ecb5c261857e491e22.zip | |
process(): If there's a bogus template for the header or footer,
causing the dictionary interpolation to fail, log this to logs/error
and insert a big red warning sign instead.
Diffstat (limited to 'Mailman')
| -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 |
