From 3cd406392bfe9bfe739033762b6fd8575bb359b5 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Wed, 12 May 2010 22:58:57 +0000
Subject: [PATCH] replace text_format by content_type

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35290 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Tool/NotificationTool.py |  4 +---
 product/ERP5/tests/testEditorField.py | 16 ++++++++--------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/product/ERP5/Tool/NotificationTool.py b/product/ERP5/Tool/NotificationTool.py
index cbb74d92e4..56c8173b5c 100644
--- a/product/ERP5/Tool/NotificationTool.py
+++ b/product/ERP5/Tool/NotificationTool.py
@@ -68,8 +68,6 @@ def buildAttachmentDictList(document_list, document_type_list=()):
       # is not (yet) part of Document API
       if getattr(attachment, 'getContentType', None) is not None:
         mime_type = attachment.getContentType()
-      elif getattr(attachment, 'getTextFormat', None) is not None:
-        mime_type = attachment.getTextFormat()
       else:
         raise ValueError, "Cannot find mimetype of the document."
 
@@ -350,7 +348,7 @@ class NotificationTool(BaseTool):
       event.setSourceValue(from_person)
       event.setDestinationValueList(to_person_list)
       event.setTitle(subject)
-      event.setTextFormat(message_text_format)
+      event.setContentType(message_text_format)
       event.setTextContent(message)
       event.setAggregateValueList(attachment_document_list)
       event_list.append(event)
diff --git a/product/ERP5/tests/testEditorField.py b/product/ERP5/tests/testEditorField.py
index c5be7435ed..3eec9c4734 100644
--- a/product/ERP5/tests/testEditorField.py
+++ b/product/ERP5/tests/testEditorField.py
@@ -196,7 +196,7 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
     # Create an event
     event = self.event_module.newContent(portal_type='Note')
     text_content = """<p>Hé Hé\nHo Ho\nHi Hi</p>"""
-    event.setTextFormat('text/html')
+    event.setContentType('text/html')
     event.setTextContent(text_content)
    
     # Set FCKEditor as preferred editor and make sure it is taken into account
@@ -226,7 +226,7 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
     # Create an event
     event = self.event_module.newContent(portal_type='Note')
     text_content = """Hé Hé\nHo Ho\nHi Hi"""
-    event.setTextFormat('text/plain')
+    event.setContentType('text/plain')
     event.setTextContent(text_content)
    
     # Set FCKEditor as preferred editor and make sure text_area is used since
@@ -257,7 +257,7 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
     # Create an event
     event = self.event_module.newContent(portal_type='Note')
     text_content = """<p>Hé Hé\nHo Ho\nHi Hi</p>"""
-    event.setTextFormat('text/html')
+    event.setContentType('text/html')
     event.setTextContent(text_content)
    
     # Set TextArea as preferred editor and make sure it is taken into account
@@ -288,7 +288,7 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
     # Create an event
     event = self.event_module.newContent(portal_type='Note')
     text_content = """Hé Hé\nHo Ho\nHi Hi"""
-    event.setTextFormat('text/plain')
+    event.setContentType('text/plain')
     event.setTextContent(text_content)
    
     # Set TextArea as preferred editor and make sure it is taken into account
@@ -316,7 +316,7 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
     # Create a web page
     page = self.web_page_module.newContent(portal_type='Web Page')
     text_content = """<p>Hé Hé\nHo Ho\nHi Hi</p>"""
-    page.setTextFormat('text/html')
+    page.setContentType('text/html')
     page.setTextContent(text_content)
 
     # Set FCKEditor as preferred editor and make sure it is taken into account
@@ -338,7 +338,7 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
     # Create a web page
     page = self.web_page_module.newContent(portal_type='Web Page')
     text_content = """Hé Hé\nHo Ho\nHi Hi"""
-    page.setTextFormat('text/plain')
+    page.setContentType('text/plain')
     page.setTextContent(text_content)
 
     # Set FCKEditor as preferred editor and make sure it is taken into account
@@ -360,7 +360,7 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
     # Create a web page
     page = self.web_page_module.newContent(portal_type='Web Page')
     text_content = """<p>Hé Hé\nHo Ho\nHi Hi</p>"""
-    page.setTextFormat('text/html')
+    page.setContentType('text/html')
     page.setTextContent(text_content)
 
     # Set TextArea as preferred editor and make sure it is taken into account
@@ -382,7 +382,7 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
     # Create a web page
     page = self.web_page_module.newContent(portal_type='Web Page')
     text_content = """Hé Hé\nHo Ho\nHi Hi"""
-    page.setTextFormat('text/plain')
+    page.setContentType('text/plain')
     page.setTextContent(text_content)
 
     # Set TextArea as preferred editor and make sure it is taken into account
-- 
2.30.9