Commit 94dc7a6b authored by Rafael Monnerat's avatar Rafael Monnerat

Store message decoded and readable by any text editor.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30447 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8dbf98d7
...@@ -34,8 +34,7 @@ import os ...@@ -34,8 +34,7 @@ import os
import transaction import transaction
import Products.ERP5Type import Products.ERP5Type
from Products.MailHost.MailHost import MailHost from Products.MailHost.MailHost import MailHost
from zLOG import LOG from email import message_from_string
import backportUnittest import backportUnittest
class FileUpload(file): class FileUpload(file):
...@@ -62,8 +61,13 @@ class DummyMailHost(MailHost): ...@@ -62,8 +61,13 @@ class DummyMailHost(MailHost):
_message_list = [] _message_list = []
def _send( self, mfrom, mto, messageText ): def _send( self, mfrom, mto, messageText ):
"""Record message in _last_message.""" """Record message in _last_message."""
message_text = messageText
for part in message_from_string(messageText).walk():
if part.get_content_type() in ['text/plain', 'text/html' ] \
and not part.is_multipart():
message_text = part.get_payload(decode=1)
self._previous_message = self._last_message self._previous_message = self._last_message
self._last_message = (mfrom, mto, messageText) self._last_message = (mfrom, mto, message_text)
self._message_list.append(self._last_message) self._message_list.append(self._last_message)
def getMessageList(self): def getMessageList(self):
""" Return message list""" """ Return message list"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment