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

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Dec 29 18:28:08 CET 2009


Author: fabien
Date: Tue Dec 29 18:28:08 2009
New Revision: 31526

URL: http://svn.erp5.org?rev=31526&view=rev
Log:
The attribute dict passed to render_odg can contain empty lists

If there is no attribute on a node, the an empty list will be adedd. So it's
required to check if the list corresponding to the current node is not empty
before applying attributes update.

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=31526&r1=31525&r2=31526&view=diff
==============================================================================
--- erp5/trunk/products/Formulator/Widget.py [utf8] (original)
+++ erp5/trunk/products/Formulator/Widget.py [utf8] Tue Dec 29 18:28:08 2009
@@ -205,19 +205,23 @@
 
     draw_frame_tag_name = '{%s}%s' % (DRAW_URI, 'frame')
     draw_frame_node = Element(draw_frame_tag_name, nsmap=NSMAP)
-    draw_frame_node.attrib.update(attr_dict.get(draw_frame_tag_name, {}).pop(0))
+    if len(attr_dict.get(draw_frame_tag_name, {})) > 0:
+      draw_frame_node.attrib.update(attr_dict.get(draw_frame_tag_name, {}).pop(0))
 
     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, {}).pop(0))
+    if len(attr_dict.get(draw_tag_name, {})) > 0:
+      draw_node.attrib.update(attr_dict.get(draw_tag_name, {}).pop(0))
 
     text_p_tag_name = '{%s}%s' % (TEXT_URI, 'p')
     text_p_node = Element(text_p_tag_name, nsmap=NSMAP)
-    text_p_node.attrib.update(attr_dict.get(text_p_tag_name, {}).pop(0))
+    if len(attr_dict.get(text_p_tag_name, {})) > 0:
+      text_p_node.attrib.update(attr_dict.get(text_p_tag_name, {}).pop(0))
 
     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, {}).pop(0))
+    if len(attr_dict.get(text_span_tag_name, {})) > 0:
+      text_span_node.attrib.update(attr_dict.get(text_span_tag_name, {}).pop(0))
 
     text_p_node.append(text_span_node)
     draw_node.append(text_p_node)




More information about the Erp5-report mailing list