From 829c72900ad4c4530a4637367913e1a562831288 Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Wed, 29 Apr 2020 11:02:18 +0200 Subject: [PATCH] [IMP]Yaltik DSL : do not regenerate XML from cached Python --- yaltik_dsl/__manifest__.py | 2 +- yaltik_dsl/xml_base.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/yaltik_dsl/__manifest__.py b/yaltik_dsl/__manifest__.py index 886dad6..d8879f2 100644 --- a/yaltik_dsl/__manifest__.py +++ b/yaltik_dsl/__manifest__.py @@ -19,7 +19,7 @@ 'name': 'Yaltik Odoo DSL base module and fns', 'summary': 'Yaltik Odoo Domain Specific Language base module and functions', 'description': """ Yaltik Odoo Domain Specific Language base module and functions """, - 'version': '10.0.0.2.2', + 'version': '10.0.0.2.3', 'category': 'Yaltik', 'author': 'Fabien Bourgeois', 'license': 'AGPL-3', diff --git a/yaltik_dsl/xml_base.py b/yaltik_dsl/xml_base.py index b92cd2a..faaa295 100644 --- a/yaltik_dsl/xml_base.py +++ b/yaltik_dsl/xml_base.py @@ -52,8 +52,9 @@ def xmln(tag='', attrs=None, children=None, text=False): def xml_write(filepath, tree): """ Write XML file according to filename and given tree """ - output_xml = minidom.parseString(ET.tostring(tree)).toprettyxml(indent=' ') - output_path = path.dirname(path.abspath(filepath)) - fpath = '%s/%s' % (output_path, path.basename(filepath).replace('.py', '_views.xml')) - with open(fpath, 'w') as output_file: - output_file.write(output_xml) + if filepath.endswith('.py'): # if .pyc, no need to generate XML + output_xml = minidom.parseString(ET.tostring(tree)).toprettyxml(indent=' ') + output_path = path.dirname(path.abspath(filepath)) + fpath = '%s/%s' % (output_path, path.basename(filepath).replace('.py', '_views.xml')) + with open(fpath, 'w') as output_file: + output_file.write(output_xml)