Browse Source

[FIX] remove usage of minidom, use pretty print feature from lxml

pull/46/head
Cédric Pigeon 10 years ago
parent
commit
d1948fb8b1
  1. 9
      help_online/models/export_help_wizard.py

9
help_online/models/export_help_wizard.py

@ -24,7 +24,6 @@ import time
import copy import copy
from lxml import etree as ET from lxml import etree as ET
from xml.dom import minidom as minidom
from openerp import models, fields, api, exceptions from openerp import models, fields, api, exceptions
from openerp.tools.translate import _ from openerp.tools.translate import _
@ -220,10 +219,9 @@ class ExportHelpWizard(models.TransientModel):
data_node.append(snippet) data_node.append(snippet)
if len(view_data_list) > 0: if len(view_data_list) > 0:
rough_string = ET.tostring(xml_to_export, encoding='utf-8',
xml_declaration=True)
reparsed = minidom.parseString(rough_string)
return reparsed.toprettyxml(indent=" ", encoding='utf-8')
return ET.tostring(xml_to_export, encoding='utf-8',
xml_declaration=True,
pretty_print=True)
else: else:
return False return False
@ -275,3 +273,4 @@ class ExportHelpWizard(models.TransientModel):
_logger.warning(_('Unable to write autobackup file ' _logger.warning(_('Unable to write autobackup file '
'in given directory: %s' 'in given directory: %s'
% autobackup_path)) % autobackup_path))
Loading…
Cancel
Save