--- f:/test-mailman/Mailman/Handlers/Decorate.py	2011-07-08 14:25:45.625000000 -0700
+++ Decorate.py	2011-07-19 20:31:08.312500000 -0700
@@ -18,7 +18,9 @@
 """Decorate a message by sticking the header and footer around it."""
 
 import re
+import errno
 
+from os import path
 from types import ListType
 from email.MIMEText import MIMEText
 
@@ -36,6 +38,8 @@
     True = 1
     False = 0
 
+end_body = re.compile('</body>', re.IGNORECASE)
+
 
 
 def process(mlist, msg, msgdata):
@@ -68,6 +72,23 @@
     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)
+    try:
+        bt = open(path.join(mm_cfg.LIST_DATA_DIR,
+                            mlist.internal_name(),
+                            'body_template')).read()
+        bt = decorate(mlist, bt, 'body addition', d)
+        if bt:
+            for part in msg.walk():
+                if part.get_content_type() == 'text/html':
+                    pl = part.get_payload(decode=True)
+                    if end_body.search(pl):
+                        pl = end_body.sub(bt + '</body>', pl)
+                    else:
+                        pl += bt
+                    part.set_payload(pl)
+                    break
+    except IOError, e:
+        if e.errno <> errno.ENOENT: raise                                     
     # Escape hatch if both the footer and header are empty
     if not header and not footer:
         return
