From 94dc7a6b6c88c94cef5f7dd98f0f83b38cafa95a Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Mon, 9 Nov 2009 20:04:13 +0000
Subject: [PATCH] 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
---
 product/ERP5Type/tests/utils.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/product/ERP5Type/tests/utils.py b/product/ERP5Type/tests/utils.py
index 10e4079bc0..4116c0c0ae 100644
--- a/product/ERP5Type/tests/utils.py
+++ b/product/ERP5Type/tests/utils.py
@@ -34,8 +34,7 @@ import os
 import transaction
 import Products.ERP5Type
 from Products.MailHost.MailHost import MailHost
-from zLOG import LOG
-
+from email import message_from_string
 import backportUnittest
 
 class FileUpload(file):
@@ -62,8 +61,13 @@ class DummyMailHost(MailHost):
   _message_list = []
   def _send( self, mfrom, mto, messageText ):
     """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._last_message = (mfrom, mto, messageText)
+    self._last_message = (mfrom, mto, message_text)
     self._message_list.append(self._last_message)
   def getMessageList(self):
     """ Return message list"""
-- 
2.30.9