Commit c87c71e0 authored by Fabien Morin's avatar Fabien Morin

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


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31230 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 47d16e99
...@@ -288,14 +288,19 @@ class TextWidget(Widget): ...@@ -288,14 +288,19 @@ class TextWidget(Widget):
""" """
if attr_dict is None: if attr_dict is None:
attr_dict = {} attr_dict = {}
draw_node = Element('{%s}%s' % (DRAW_URI, 'text-box'), draw_tag_name = '{%s}%s' % (DRAW_URI, 'text-box')
nsmap=NSMAP) draw_node = Element(draw_tag_name, nsmap=NSMAP)
text_node = Element('{%s}%s' % (TEXT_URI, local_name), draw_node.attrib.update(attr_dict.get(draw_tag_name, {}))
nsmap=NSMAP) text_p_tag_name = '{%s}%s' % (TEXT_URI, local_name)
draw_node.append(text_node) 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 # get the field value
text_node.text = field.get_value('default').decode('utf-8') text_span_node.text = field.get_value('default').decode('utf-8')
text_node.attrib.update(attr_dict)
if as_string: if as_string:
return etree.tostring(draw_node) return etree.tostring(draw_node)
return draw_node return draw_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