[Erp5-report] r31589 leonardo - /erp5/trunk/products/ERP5/tests/testEditorField.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Jan 5 19:07:26 CET 2010
Author: leonardo
Date: Tue Jan 5 19:07:21 2010
New Revision: 31589
URL: http://svn.erp5.org?rev=31589&view=rev
Log:
Fix Zope 2.12 breakages on testEditorField, along with commit #31588, as soon as the fix for https://bugs.launchpad.net/zope2/+bug/246983 is applied on Zope 2.12
Modified:
erp5/trunk/products/ERP5/tests/testEditorField.py
Modified: erp5/trunk/products/ERP5/tests/testEditorField.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testEditorField.py?rev=31589&r1=31588&r2=31589&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testEditorField.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testEditorField.py [utf8] Tue Jan 5 19:07:21 2010
@@ -93,6 +93,15 @@
def getDefaultSitePreference(self):
return self.getPreferenceTool().default_site_preference
+ def _fromUnicode(self, html_text):
+ """
+ ZPTs in Zope 2.12 render to unicode. Here we normalize to utf-8
+ """
+ # XXX: We should consider switching ERP5 to Unicode instead.
+ if isinstance(html_text, unicode):
+ html_text = html_text.encode('utf-8')
+ return html_text
+
def _testPreferredDocumentEditor(self, event, preferred_editor, editor, form_id, field_id):
"""
Common code to test if current document (event)
@@ -126,6 +135,7 @@
text_content -- the embedded text content
"""
+ html_text = self._fromUnicode(html_text)
match_string1 = "var oFCKeditor = new FCKeditor('field_%s');" % field_id
match_string2 = "oFCKeditor.Value = '%s';" % ('\\n'.join(text_content.splitlines()))
if html_text.find(match_string1) == -1:
@@ -150,6 +160,7 @@
text_content -- the embedded text content
"""
+ html_text = self._fromUnicode(html_text)
match_string = """name="field_%s" >%s</textarea>""" % (field_id, text_content)
if html_text.find(match_string) == -1:
print html_text
@@ -168,6 +179,7 @@
document -- the document which content is displayed in
read only mode
"""
+ html_text = self._fromUnicode(html_text)
text_content = document.asStrippedHTML()
match_string1 = """<div class="input">%s</div>""" % text_content
match_string2 = """<div class="field page"""
More information about the Erp5-report
mailing list