Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Chameleon 4.6.0. #1252

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Upgrade to Chameleon 4.6.0. #1252

wants to merge 1 commit into from

Conversation

mauritsvanrees
Copy link
Member

We should use latest Chameleon (only possible on Python 3.9+) to avoid deprecation warnings for some changes in the ast module. In Python 3.14 these will become errors.
See chameleon PR.

Zope itself also uses some deprecated ast code in Products.PageTemplates. And z3c.pt does it as well. Maybe it needs to be fixed there first:

...Zope/src/Products/PageTemplates/engine.py:312: DeprecationWarning:
  ast.Str is deprecated and will be removed in Python 3.14;
  use ast.Constant instead
    type=ast.Str(self.type),
.../Zope/src/Products/PageTemplates/engine.py:313: DeprecationWarning:
  ast.Str is deprecated and will be removed in Python 3.14;
  use ast.Constant instead
    expression=ast.Str(self.expression),
...z3c/pt/expressions.py:178: DeprecationWarning:
  ast.Str is deprecated and will be removed in Python 3.14;
  use ast.Constant instead
    component = ast.Str(part)

At any rate the Zope tests currently fail with latest Chameleon:

Failure in test testBatchIteration (Products.PageTemplates.tests.testChameleonTalesExpressions.ChameleonTalesExpressionTests.testBatchIteration)
Traceback (most recent call last):
  File "/Users/maurits/.pyenv/versions/3.13.1/lib/python3.13/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/Users/maurits/.pyenv/versions/3.13.1/lib/python3.13/unittest/case.py", line 651, in run
    self._callTestMethod(testMethod)
  File "/Users/maurits/.pyenv/versions/3.13.1/lib/python3.13/unittest/case.py", line 606, in _callTestMethod
    if method() is not None:
  File "/Users/maurits/community/plone-coredev/6.2/src/Zope/src/Products/PageTemplates/tests/testHTMLTests.py", line 177, in testBatchIteration
    self.assert_expected(self.folder.t, 'CheckBatchIteration.html')
  File "/Users/maurits/community/plone-coredev/6.2/src/Zope/src/Products/PageTemplates/tests/testHTMLTests.py", line 96, in assert_expected
    assert not t._v_errors, 'Template errors: %s' % t._v_errors
AssertionError: Template errors: ['Compilation failed', 'builtins.IndentationError: unexpected indent (85fd4b83cc53a097d3f8a169b0279653.py, line 5)']

I did not yet manage to get that generated python file and see what the source code is.

@icemac
Copy link
Member

icemac commented Feb 12, 2025

According to https://chameleon.readthedocs.io/en/latest/configuration.html either CHAMELEON_CACHE and/or CHAMELEON_DEBUG should do the trick to inspect the contents of that file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants