[Erp5-report] r31786 nicolas - /erp5/trunk/products/Formulator/Widget.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jan 15 19:12:46 CET 2010


Author: nicolas
Date: Fri Jan 15 19:12:45 2010
New Revision: 31786

URL: http://svn.erp5.org?rev=31786&view=rev
Log:
* lxml accept only unicode or ascii in text nodes
reviewed by Romain

Modified:
    erp5/trunk/products/Formulator/Widget.py

Modified: erp5/trunk/products/Formulator/Widget.py
URL: http://svn.erp5.org/erp5/trunk/products/Formulator/Widget.py?rev=31786&r1=31785&r2=31786&view=diff
==============================================================================
--- erp5/trunk/products/Formulator/Widget.py [utf8] (original)
+++ erp5/trunk/products/Formulator/Widget.py [utf8] Fri Jan 15 19:12:45 2010
@@ -185,6 +185,9 @@
     """
     if attr_dict is None:
       attr_dict = {}
+    if isinstance(value, str):
+      #required by lxml
+      value = value.decode('utf-8')
     text_node = Element('{%s}%s' % (TEXT_URI, local_name), nsmap=NSMAP)
     text_node.text = value
     text_node.attrib.update(attr_dict)
@@ -204,7 +207,9 @@
     """
     if attr_dict is None:
       attr_dict = {}
-
+    if isinstance(value, str):
+      #required by lxml
+      value = value.decode('utf-8')
     draw_frame_tag_name = '{%s}%s' % (DRAW_URI, 'frame')
     draw_frame_node = Element(draw_frame_tag_name, nsmap=NSMAP)
     if len(attr_dict.get(draw_frame_tag_name, {})) > 0:
@@ -494,6 +499,9 @@
         render_prefix, attr_dict, local_name):
         if attr_dict is None:
             attr_dict = {}
+        if isinstance(value, str):
+            #required by lxml
+            value = value.decode('utf-8')
         text_node = Element('{%s}%s' % (TEXT_URI, local_name), nsmap=NSMAP)
         def replaceCharsByNode(match_object):
             #global text_node




More information about the Erp5-report mailing list