diff --git a/addons/web_editor/models/ir_ui_view.py b/addons/web_editor/models/ir_ui_view.py index 8b69d6e02ec..8a3459b9b06 100644 --- a/addons/web_editor/models/ir_ui_view.py +++ b/addons/web_editor/models/ir_ui_view.py @@ -74,7 +74,7 @@ class IrUiView(models.Model): vals = { 'inherit_id': self.id, 'name': '%s (%s)' % (self.name, el.get('id')), - 'arch': self._pretty_arch(arch), + 'arch': etree.tostring(arch, encoding='unicode'), 'key': '%s_%s' % (self.key, el.get('id')), 'type': 'qweb', 'mode': 'extension', @@ -88,19 +88,6 @@ class IrUiView(models.Model): def _save_oe_structure_hook(self): return {} - @api.model - def _pretty_arch(self, arch): - # remove_blank_string does not seem to work on HTMLParser, and - # pretty-printing with lxml more or less requires stripping - # whitespace: http://lxml.de/FAQ.html#why-doesn-t-the-pretty-print-option-reformat-my-xml-output - # so serialize to XML, parse as XML (remove whitespace) then serialize - # as XML (pretty print) - arch_no_whitespace = etree.fromstring( - etree.tostring(arch, encoding='utf-8'), - parser=etree.XMLParser(encoding='utf-8', remove_blank_text=True)) - return etree.tostring( - arch_no_whitespace, encoding='unicode', pretty_print=True) - @api.model def _are_archs_equal(self, arch1, arch2): # Note that comparing the strings would not be ok as attributes order @@ -207,7 +194,7 @@ class IrUiView(models.Model): old_arch = etree.fromstring(self.arch.encode('utf-8')) if not self._are_archs_equal(old_arch, new_arch): self._set_noupdate() - self.write({'arch': self._pretty_arch(new_arch)}) + self.write({'arch': etree.tostring(new_arch, encoding='unicode')}) @api.model def _view_get_inherited_children(self, view): diff --git a/addons/website/static/tests/tours/rte.js b/addons/website/static/tests/tours/rte.js index eda5f989405..41092c0216b 100644 --- a/addons/website/static/tests/tours/rte.js +++ b/addons/website/static/tests/tours/rte.js @@ -228,7 +228,7 @@ wTourUtils.registerWebsitePreviewTour('rte_translator', { content: "Check that the editor is not showing translated content (1)", trigger: '.ace_text-layer .ace_line:contains("an HTML")', run: function (actions) { - var lineEscapedText = $(this.$anchor.text()).text(); + var lineEscapedText = $(this.$anchor.text()).last().text(); if (lineEscapedText !== "<b></b> is an HTML tag & is empty") { console.error('The HTML editor should display the correct untranslated content'); $('iframe:not(.o_ignore_in_tour)').contents().find('body').addClass('rte_translator_error');