From 32c29944e75217fa5b05a2ee62b7f336c1c6eca6 Mon Sep 17 00:00:00 2001 From: ale-rt Date: Tue, 30 Apr 2024 16:28:14 +0200 Subject: [PATCH] Revert "When calling the html serializer pass an encoding" This reverts commit fc246c022ba23fa8cc77840d6e26f531e05ed998. --- news/238.bugfix | 1 - src/plone/app/theming/tests/test_transform.py | 27 +------------------ src/plone/app/theming/transform.py | 5 +--- 3 files changed, 2 insertions(+), 31 deletions(-) delete mode 100644 news/238.bugfix diff --git a/news/238.bugfix b/news/238.bugfix deleted file mode 100644 index c90b2a4b..00000000 --- a/news/238.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix an issue with unicode characters happening with lxml 5 [ale-rt] diff --git a/src/plone/app/theming/tests/test_transform.py b/src/plone/app/theming/tests/test_transform.py index faafa34c..ddb57c9d 100644 --- a/src/plone/app/theming/tests/test_transform.py +++ b/src/plone/app/theming/tests/test_transform.py @@ -1,13 +1,11 @@ from App.config import getConfiguration from diazo.compiler import compile_theme -from html import unescape from lxml import etree from os import environ from plone.app.testing import setRoles from plone.app.testing import TEST_USER_ID from plone.app.theming.interfaces import IThemeSettings from plone.app.theming.testing import THEMING_FUNCTIONAL_TESTING -from plone.app.theming.testing import THEMING_INTEGRATION_TESTING from plone.app.theming.transform import ThemeTransform from plone.app.theming.utils import applyTheme from plone.app.theming.utils import getTheme @@ -27,30 +25,7 @@ import unittest -class IntegrationTestCase(unittest.TestCase): - - layer = THEMING_INTEGRATION_TESTING - - def test_transform_parseTree_with_unicode(self): - request = self.layer["request"] - request.response.setHeader("Content-Type", "text/html; charset=utf-8") - transform = ThemeTransform(None, request) - snippet = "\n".join( - ( - "", - "", - "", - "
à
", - "", - "", - ) - ) - parsed = transform.parseTree([snippet.encode()]) - serialized = unescape(parsed.serialize().decode()) - self.assertEqual(snippet, serialized) - - -class FunctionalTestCase(unittest.TestCase): +class TestCase(unittest.TestCase): layer = THEMING_FUNCTIONAL_TESTING def setUp(self): diff --git a/src/plone/app/theming/transform.py b/src/plone/app/theming/transform.py index 3f74c015..eb388d5c 100644 --- a/src/plone/app/theming/transform.py +++ b/src/plone/app/theming/transform.py @@ -13,7 +13,6 @@ from zope.component import adapter from zope.interface import implementer from zope.interface import Interface -from ZPublisher.HTTPRequest import default_encoding import logging @@ -121,9 +120,7 @@ def parseTree(self, result): return None try: - return getHTMLSerializer( - result, pretty_print=False, encoding=default_encoding - ) + return getHTMLSerializer(result, pretty_print=False) except (AttributeError, TypeError, etree.ParseError): return None