[Erp5-report] r31230 fabien - /erp5/trunk/products/Formulator/Widget.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Dec 11 10:36:26 CET 2009


Author: fabien
Date: Fri Dec 11 10:36:25 2009
New Revision: 31230

URL: http://svn.erp5.org?rev=31230&view=rev
Log:
the key of the dict attr_dict change, now its the node.tag, so adapt the code
according to romain, attr_dict variable is a bad name and will be everywhere in
future commit.

reviewed and approved 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=31230&r1=31229&r2=31230&view=diff
==============================================================================
--- erp5/trunk/products/Formulator/Widget.py [utf8] (original)
+++ erp5/trunk/products/Formulator/Widget.py [utf8] Fri Dec 11 10:36:25 2009
@@ -288,14 +288,19 @@
     """
     if attr_dict is None:
       attr_dict = {}
-    draw_node = Element('{%s}%s' % (DRAW_URI, 'text-box'),
-        nsmap=NSMAP)
-    text_node = Element('{%s}%s' % (TEXT_URI, local_name),
-        nsmap=NSMAP)
-    draw_node.append(text_node)
+    draw_tag_name = '{%s}%s' % (DRAW_URI, 'text-box')
+    draw_node = Element(draw_tag_name, nsmap=NSMAP)
+    draw_node.attrib.update(attr_dict.get(draw_tag_name, {}))
+    text_p_tag_name = '{%s}%s' % (TEXT_URI, local_name)
+    text_p_node = Element(text_p_tag_name, nsmap=NSMAP)
+    text_p_node.attrib.update(attr_dict.get(text_p_tag_name, {}))
+    text_span_tag_name = '{%s}%s' % (TEXT_URI, 'span')
+    text_span_node =  Element(text_span_tag_name, nsmap=NSMAP)
+    text_span_node.attrib.update(attr_dict.get(text_span_tag_name, {}))
+    text_p_node.append(text_span_node)
+    draw_node.append(text_p_node)
     # get the field value
-    text_node.text = field.get_value('default').decode('utf-8')
-    text_node.attrib.update(attr_dict)
+    text_span_node.text = field.get_value('default').decode('utf-8')
     if as_string:
       return etree.tostring(draw_node)
     return draw_node




More information about the Erp5-report mailing list