Changeset View
Changeset View
Standalone View
Standalone View
wallace/module_footer.py
Show First 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | for part in message.walk(): | ||||
pass | pass | ||||
log.debug("Walking message part: %s; disposition = %r" % (content_type, disposition), level=8) | log.debug("Walking message part: %s; disposition = %r" % (content_type, disposition), level=8) | ||||
if not disposition == None: | if not disposition == None: | ||||
continue | continue | ||||
if content_type == "text/plain": | if content_type == "text/plain": | ||||
content = part.get_payload() | content = part.get_payload(decode=True) | ||||
content += "\n\n-- \n%s" % (footer['plain']) | content += "\n\n-- \n%s" % (footer['plain']) | ||||
part.set_payload(content) | part.set_payload(content) | ||||
footer_added = True | footer_added = True | ||||
log.debug("Text footer attached.", level=6) | log.debug("Text footer attached.", level=6) | ||||
elif content_type == "text/html": | elif content_type == "text/html": | ||||
content = part.get_payload() | content = part.get_payload(decode=True) | ||||
append = "\n<!-- footer appended by Wallace -->\n" + footer['html'] | append = "\n<!-- footer appended by Wallace -->\n" + footer['html'] | ||||
if "</body>" in content: | if "</body>" in content: | ||||
part.set_payload(content.replace("</body>", append + "</body>")) | part.set_payload(content.replace("</body>", append + "</body>")) | ||||
else: | else: | ||||
part.set_payload("<html><body>" + content + append + "</body></html>") | part.set_payload("<html><body>" + content + append + "</body></html>") | ||||
footer_added = True | footer_added = True | ||||
log.debug("HTML footer attached.", level=6) | log.debug("HTML footer attached.", level=6) | ||||
Show All 11 Lines |