[IMP]Yaltik DSL : do not regenerate XML from cached Python

This commit is contained in:
Fabien BOURGEOIS 2020-04-29 11:02:18 +02:00
parent 8709bd2195
commit 829c72900a
2 changed files with 7 additions and 6 deletions

View File

@ -19,7 +19,7 @@
'name': 'Yaltik Odoo DSL base module and fns', 'name': 'Yaltik Odoo DSL base module and fns',
'summary': 'Yaltik Odoo Domain Specific Language base module and functions', 'summary': 'Yaltik Odoo Domain Specific Language base module and functions',
'description': """ 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', 'category': 'Yaltik',
'author': 'Fabien Bourgeois', 'author': 'Fabien Bourgeois',
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

@ -52,8 +52,9 @@ def xmln(tag='', attrs=None, children=None, text=False):
def xml_write(filepath, tree): def xml_write(filepath, tree):
""" Write XML file according to filename and given tree """ """ Write XML file according to filename and given tree """
output_xml = minidom.parseString(ET.tostring(tree)).toprettyxml(indent=' ') if filepath.endswith('.py'): # if .pyc, no need to generate XML
output_path = path.dirname(path.abspath(filepath)) output_xml = minidom.parseString(ET.tostring(tree)).toprettyxml(indent=' ')
fpath = '%s/%s' % (output_path, path.basename(filepath).replace('.py', '_views.xml')) output_path = path.dirname(path.abspath(filepath))
with open(fpath, 'w') as output_file: fpath = '%s/%s' % (output_path, path.basename(filepath).replace('.py', '_views.xml'))
output_file.write(output_xml) with open(fpath, 'w') as output_file:
output_file.write(output_xml)