[Erp5-report] r33918 nicolas - in /erp5/trunk/products/ERP5Form: ./ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Mar 19 16:27:33 CET 2010
Author: nicolas
Date: Fri Mar 19 16:27:31 2010
New Revision: 33918
URL: http://svn.erp5.org?rev=33918&view=rev
Log:
If Editor field edit raw_text, it should behave like TextAreaField,
So use TextAreaWidget.render_view for that specific case.
Modified:
erp5/trunk/products/ERP5Form/EditorField.py
erp5/trunk/products/ERP5Form/tests/testFields.py
Modified: erp5/trunk/products/ERP5Form/EditorField.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/EditorField.py?rev=33918&r1=33917&r2=33918&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/EditorField.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/EditorField.py [utf8] Fri Mar 19 16:27:31 2010
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2002-2006 Nexedi SARL and Contributors. All Rights Reserved.
@@ -89,8 +90,14 @@
Render form in view only mode.
"""
if value is None:
- value = ''
- return value
+ return ''
+ text_editor = field.get_value('text_editor')
+ if text_editor == 'text_area':
+ return Widget.TextAreaWidget.render_view(self, field, value,
+ REQUEST=REQUEST,
+ render_prefix=REQUEST)
+ else:
+ return value
EditorWidgetInstance = EditorWidget()
Modified: erp5/trunk/products/ERP5Form/tests/testFields.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/tests/testFields.py?rev=33918&r1=33917&r2=33918&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/tests/testFields.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/tests/testFields.py [utf8] Fri Mar 19 16:27:31 2010
@@ -49,7 +49,7 @@
from Products.ERP5Form.Form import purgeFieldValueCache
from Products.ERP5Form.Form import getFieldValue
from Products.ERP5Form import Form
-from Products.ERP5Form import ProxyField
+from Products.ERP5Form import ProxyField, EditorField
from DateTime import DateTime
from Products.Formulator.Widget import NSMAP
@@ -296,6 +296,18 @@
test_value = self.field.render_odg(as_string=False)\
.xpath('%s/text:tab' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)
self.assertTrue(test_value)
+
+class TestEditorField(TestTextAreaField):
+ """Tests Editor field
+ """
+
+ def getTitle(self):
+ return "Editor Field"
+
+ def afterSetUp(self):
+ self.field = EditorField.EditorField('test_field')
+ self.widget = self.field.widget
+
class TestLinesField(ERP5TypeTestCase):
@@ -803,6 +815,7 @@
suite.addTest(unittest.makeSuite(TestStringField))
suite.addTest(unittest.makeSuite(TestDateTimeField))
suite.addTest(unittest.makeSuite(TestTextAreaField))
+ suite.addTest(unittest.makeSuite(TestEditorField))
suite.addTest(unittest.makeSuite(TestLinesField))
suite.addTest(unittest.makeSuite(TestCheckBoxField))
suite.addTest(unittest.makeSuite(TestListField))
More information about the Erp5-report
mailing list