Commit 4a9cd5d8 authored by Fabien Morin's avatar Fabien Morin

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.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31526 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 43a69d36
...@@ -205,19 +205,23 @@ class Widget: ...@@ -205,19 +205,23 @@ class Widget:
draw_frame_tag_name = '{%s}%s' % (DRAW_URI, 'frame') draw_frame_tag_name = '{%s}%s' % (DRAW_URI, 'frame')
draw_frame_node = Element(draw_frame_tag_name, nsmap=NSMAP) 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_tag_name = '{%s}%s' % (DRAW_URI, 'text-box')
draw_node = Element(draw_tag_name, nsmap=NSMAP) 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_tag_name = '{%s}%s' % (TEXT_URI, 'p')
text_p_node = Element(text_p_tag_name, nsmap=NSMAP) 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_tag_name = '{%s}%s' % (TEXT_URI, 'span')
text_span_node = Element(text_span_tag_name, nsmap=NSMAP) 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) text_p_node.append(text_span_node)
draw_node.append(text_p_node) draw_node.append(text_p_node)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment