From b182a788ed6113154e46e20e5b5b74d58b549360 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Tue, 8 Jan 2008 10:02:38 +0000
Subject: [PATCH] add compatibility for former mail message

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18626 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/MailMessage.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/product/ERP5/Document/MailMessage.py b/product/ERP5/Document/MailMessage.py
index 7a0b6ce69b..5e721ffe46 100644
--- a/product/ERP5/Document/MailMessage.py
+++ b/product/ERP5/Document/MailMessage.py
@@ -38,6 +38,8 @@ import smtplib
 
 from zLOG import LOG
 
+_MARKER = []
+
 class MailMessage(Event, CMFMailInMessage):
   """
   LEGACY
@@ -109,3 +111,18 @@ class MailMessage(Event, CMFMailInMessage):
       header += "\n"
       msg = header + msg
       self.MailHost.send( msg )
+
+
+  security.declareProtected(Permissions.AccessContentsInformation, 'getTextContent')
+  def getTextContent(self, default=_MARKER):
+    """
+    Overload EmailDocument method to add backward compatibility layer
+    """
+    if getattr(self, 'body', None) is not None:
+      return self.getBody(default)
+    else:
+      if default is _MARKER:
+        return Event.getTextContent(self)
+      else:
+        return Event.getTextContent(self, default)
+        
-- 
2.30.9