Commit 841d4a5a authored by Aurel's avatar Aurel Committed by Jérome Perrin

make diff even if not xml

parent f92f62cd
...@@ -35,12 +35,19 @@ def diffXML(xml_plugin="", xml_erp5="", html=True): ...@@ -35,12 +35,19 @@ def diffXML(xml_plugin="", xml_erp5="", html=True):
xml_plugin="<object>Not found</object>" xml_plugin="<object>Not found</object>"
if xml_erp5 == "": if xml_erp5 == "":
xml_erp5="<object>Not found</object>" xml_erp5="<object>Not found</object>"
xml = etree.fromstring(xml_erp5) try:
xml_erp5 = etree.tostring(xml, pretty_print=True, encoding="utf-8") xml = etree.fromstring(xml_erp5)
xml_erp5 = etree.tostring(xml, pretty_print=True, encoding="utf-8")
except etree.XMLSyntaxError:
pass
if isinstance(xml_plugin, unicode): if isinstance(xml_plugin, unicode):
xml_plugin = xml_plugin.encode('utf-8') xml_plugin = xml_plugin.encode('utf-8')
xml = etree.fromstring(xml_plugin) try:
xml_plugin = etree.tostring(xml, pretty_print=True, encoding="utf-8") xml = etree.fromstring(xml_plugin)
xml_plugin = etree.tostring(xml, pretty_print=True, encoding="utf-8")
except etree.XMLSyntaxError:
pass
diff_list = list(unified_diff(xml_plugin.split('\n'), xml_erp5.split('\n'), tofile="erp5 xml", fromfile="plugin xml", lineterm='')) diff_list = list(unified_diff(xml_plugin.split('\n'), xml_erp5.split('\n'), tofile="erp5 xml", fromfile="plugin xml", lineterm=''))
if len(diff_list) != 0: if len(diff_list) != 0:
......
118 119
\ No newline at end of file
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