Skip to content

Use extended expression context for Control Panel actions#4341

Open
erral wants to merge 2 commits into
masterfrom
erral-issue3288
Open

Use extended expression context for Control Panel actions#4341
erral wants to merge 2 commits into
masterfrom
erral-issue3288

Conversation

@erral

@erral erral commented Jun 11, 2026

Copy link
Copy Markdown
Member

This PR introduces a more flexible expression context for Control Panel actions.

By using get_current_context(), we can now use TALES expressions that depend on the current context (e.g., checking if a specific behavior is enabled on the current folder or document) when deciding whether to show a configlet in the control panel.

Changes:

  • Added get_current_context() to Products.CMFPlone.utils to reliably find the current content object from the request.
  • Updated PloneControlPanel.enumConfiglets to use the current context for expression evaluation.
  • Added comprehensive tests for get_current_context().
  • Removed an unused import in PloneControlPanel.py.

Fixes #3288

@mister-roboto

Copy link
Copy Markdown

@erral thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@erral erral force-pushed the erral-issue3288 branch from 0820160 to 20dc21a Compare June 11, 2026 20:26
@erral

erral commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

@jenkins-plone-org please run jobs

@gforcada gforcada left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM without being an expert on this area of the code 😄

Comment thread src/Products/CMFPlone/tests/test_utils.py Outdated
Comment thread src/Products/CMFPlone/tests/test_controlpanel_expr.py Outdated
@erral

erral commented Jun 13, 2026

Copy link
Copy Markdown
Member Author

@jenkins-plone-org please run jobs

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.

PloneControlpanel should use extended expression context provided by PloneBaseTool

3 participants