Commit f7bec530 authored by Nicolas Delaby's avatar Nicolas Delaby

remove text:formula attributes which keep nodes to be updated

add style URI to have shorter xml output


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44298 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e04255d4
...@@ -16,12 +16,14 @@ DRAW_URI = 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0' ...@@ -16,12 +16,14 @@ DRAW_URI = 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0'
TEXT_URI = 'urn:oasis:names:tc:opendocument:xmlns:text:1.0' TEXT_URI = 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'
FORM_URI = 'urn:oasis:names:tc:opendocument:xmlns:form:1.0' FORM_URI = 'urn:oasis:names:tc:opendocument:xmlns:form:1.0'
OFFICE_URI = 'urn:oasis:names:tc:opendocument:xmlns:office:1.0' OFFICE_URI = 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'
STYLE_URI = 'urn:oasis:names:tc:opendocument:xmlns:style:1.0'
NSMAP = { NSMAP = {
'draw': DRAW_URI, 'draw': DRAW_URI,
'text': TEXT_URI, 'text': TEXT_URI,
'form': FORM_URI, 'form': FORM_URI,
'office': OFFICE_URI, 'office': OFFICE_URI,
'style': STYLE_URI,
} }
EForm = ElementMaker(namespace=FORM_URI, nsmap=NSMAP) EForm = ElementMaker(namespace=FORM_URI, nsmap=NSMAP)
...@@ -1752,6 +1754,9 @@ class IntegerWidget(TextWidget) : ...@@ -1752,6 +1754,9 @@ class IntegerWidget(TextWidget) :
text_node = Element('{%s}%s' % (TEXT_URI, local_name), nsmap=NSMAP) text_node = Element('{%s}%s' % (TEXT_URI, local_name), nsmap=NSMAP)
text_node.text = str(value) text_node.text = str(value)
attr_dict['{%s}value' % OFFICE_URI] = str(value) attr_dict['{%s}value' % OFFICE_URI] = str(value)
formula_attribute_name = '{%s}formula' % TEXT_URI
if formula_attribute_name in attr_dict:
del attr_dict[formula_attribute_name]
text_node.attrib.update(attr_dict) text_node.attrib.update(attr_dict)
if as_string: if as_string:
return etree.tostring(text_node) return etree.tostring(text_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