diff --git a/CHANGES.rst b/CHANGES.rst index 1c6fde954b..47c190acaf 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -11,6 +11,11 @@ https://github.com/zopefoundation/Zope/blob/4.x/CHANGES.rst 5.0a3 (unreleased) ------------------ +- Make "Unicode Conflict Resolution" available for templates + rendered with ``chameleon`` + (`Products.CMFPlone#3145 + `_). + - New interface ``Products.PageTemplates.interfaces.IZopeAwareEngine``. It can be used as the "provides" of an adapter registration to adapt a non ``Zope`` tales engine to an engine to be used diff --git a/src/Products/PageTemplates/engine.py b/src/Products/PageTemplates/engine.py index 1e3d1506c2..d61c388610 100644 --- a/src/Products/PageTemplates/engine.py +++ b/src/Products/PageTemplates/engine.py @@ -33,10 +33,10 @@ from zope.pagetemplate.interfaces import IPageTemplateProgram from zope.tales.expressions import PathExpr from zope.tales.expressions import SubPathExpr -from zope.tales.tales import Context from .Expressions import PathIterator from .Expressions import SecureModuleImporter +from .Expressions import ZopeContext from .interfaces import IZopeAwareEngine @@ -146,7 +146,7 @@ def _compile_zt_expr(type, expression, engine=None, econtext=None): _compile_zt_expr_node = Static(Symbol(_compile_zt_expr)) -class _C2ZContextWrapper(Context): +class _C2ZContextWrapper(ZopeContext): """Behaves like "zope" context with vars from "chameleon" context.""" def __init__(self, c_context, attrs): self.__c_context = c_context diff --git a/src/Products/PageTemplates/tests/testZopePageTemplate.py b/src/Products/PageTemplates/tests/testZopePageTemplate.py index 3f3e0e8eec..f1b043c8d0 100644 --- a/src/Products/PageTemplates/tests/testZopePageTemplate.py +++ b/src/Products/PageTemplates/tests/testZopePageTemplate.py @@ -124,11 +124,11 @@ def testExtractCharsetFromMetaHTTPEquivTag(self): class ZPTUnicodeEncodingConflictResolution(ZopeTestCase): - # BBB The unicode conflict resolution feature is only available - # for the old Zope page template engine! + + select_engine = staticmethod(useOldZopeEngine) def afterSetUp(self): - useOldZopeEngine() + self.select_engine() zope.component.provideAdapter(DefaultTraversable, (None,)) zope.component.provideAdapter(HTTPCharsets, (None,)) provideUtility(PreferredCharsetResolver, @@ -234,6 +234,12 @@ def testDebugFlags(self): self.assertEqual(zpt.pt_render().startswith('