Skip to content

Commit

Permalink
Adaptations for chameleon>=3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
d-maurer committed Jun 26, 2020
1 parent 183fc1e commit 26dfbba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Products/PageTemplates/engine.py
Expand Up @@ -18,6 +18,7 @@
from chameleon.codegen import template
from chameleon.exc import ExpressionError
from chameleon.tal import RepeatDict
from chameleon.tales import DEFAULT_MARKER # ``chameleon>=3.7.5``
from chameleon.zpt.template import Macros

from AccessControl.class_init import InitializeClass
Expand Down Expand Up @@ -316,10 +317,7 @@ def __call__(self, context, macros, tal=True, **options):
kwargs["__zt_context__"] = context

template = self.template
# ``chameleon`` uses ``intern('__default__')`` as TALES ``default``
# from version 3.7.4 on. The code below will not work
# for earlier versions
kwargs["default"] = intern('__default__')
kwargs["default"] = DEFAULT_MARKER

return template.render(**kwargs)

Expand Down
2 changes: 2 additions & 0 deletions src/Products/PageTemplates/tests/input/Default.html
Expand Up @@ -4,5 +4,7 @@
<p tal:define="foo string:"
tal:content="python: foo or default">Default in Python expression</p>
<p tal:content="context/I_Fail|default">Default in Path expression</p>
<p><span tal:replace="default">Default in replace</span></p>
<p attr="attribute default" tal:attributes="attr default"></p>
</body>
</html>
2 changes: 2 additions & 0 deletions src/Products/PageTemplates/tests/output/Default.html
Expand Up @@ -3,5 +3,7 @@
<body>
<p>Default in Python expression</p>
<p>Default in Path expression</p>
<p><span>Default in replace</span></p>
<p attr="attribute default"></p>
</body>
</html>

0 comments on commit 26dfbba

Please sign in to comment.