collective.behavior.talcondition
Overview
This package provides a Dexterity behavior.
It adds two fields on a content type:
-
tal_condition : enter a TAL expression that once evaluated will return 'True' if content should be available. By default, elements 'member', 'context' and 'portal' are available for the expression but the TAL expression context may be extended using the 'extra_expr_ctx' parameter.
-
roles_bypassing_talcondition : choose the different roles for which the TAL condition will not be evaluated and always considered 'True'
It's then possible to use the 'evaluate' method to test the TAL condition.
How to use it
Activate the behavior on your content type.
Compatibility
Version 2.x supports Plone 6.2 on Python 3.10 to 3.14. It works only with Dexterity content types.
For older Plone versions, and for the Archetypes schema extender, use collective.behavior.talcondition 1.1.3.
Installation
Add collective.behavior.talcondition to the dependencies of your project
(pyproject.toml, or requirements.txt with the Plone constraints), install
it, restart Plone and activate the add-on in Site Setup > Add-ons.
Development
Requires uv. This installs Plone 6.2.3 in .venv
(use PLONE_VERSION=6.2.2 make install for another version) and the prek
git hook:
make install
make start # Plone on http://localhost:8080 (admin / admin)
Create a Classic UI site from the browser, then activate collective.behavior.talcondition.
Tests
Tests run through tox, as the CI does:
make test # Plone 6.2.3
uvx --with tox-uv tox -e py314-plone62 # one Plone / Python combination
make test-all # lint, every combination, dependencies
Without tox:
.venv/bin/zope-testrunner --test-path=src -s collective.behavior.talcondition
Lint
make check # format then lint (pyupgrade, isort, black, zpretty, flake8...)
Translations
make i18n # rebuild the collective.behavior.talcondition catalog
.editorconfig, .flake8, .gitignore, .pre-commit-config.yaml, tox.ini,
.github/ and the tool sections of pyproject.toml are generated by
plone.meta: change .meta.toml, then run
uvx --from plone.meta config-package --no-commit --branch current ..
Translations
This product has been translated into
-
French.
-
Spanish.
You can contribute for any message missing or other new languages, join us at Plone Collective Team into Transifex.net service with all world Plone translators community.
Contribute
- Issue Tracker: https://github.com/collective/collective.behavior.talcondition/issues
- Source Code: https://github.com/collective/collective.behavior.talcondition
License
The project is licensed under the GPLv2.
Contributors
- Leonardo J. Caballero G., leonardocaballero@gmail.com
Changelog
2.0.0 (2026-11-20)
-
Use native namespace packages (PEP 420). Remove the
pkg_resourcesnamespace declarations. This version needs Python 3.10 or later and Plone 6.2. [boulch] -
Breaking: drop the Archetypes schema extender (
extender.pyandutils.applyExtender) and the code for Plone 4 and 5, including thePLONE_VERSIONconstant. Use 1.1.3 for older Plone versions. [remdub] -
Take
get_installerfromplone.baseand the test layer helpers fromplone.testing.zopeinstead of the aliases Plone 6.2 deprecates. Log withlogger.warninginstead of the deprecatedlogger.warn. [remdub] -
Configure the package with plone.meta 2.12.0 (test matrix on Plone 6.2.3 with Python 3.10 to 3.14), move its metadata to
pyproject.toml, convert the documentation to Markdown and run the development environment on Plone 6.2.3 with uv instead of buildout. Drop the buildout configuration, the hand-written GitHub workflow and the empty robot test setup. [remdub]
1.1.3 (2026-06-19)
- In case an error occurs, output more information to the log. [gbastien]
1.1.2 (2026-05-20)
- Added parameter
return_bool=Falsetoutils.evaluateExpressionForandutils._evaluateExpressionto ensure that returned result will always be a bool (TrueorFalse). [gbastien]
1.1.1 (2025-08-28)
- Added
checkPermissionfromportal_membershipto base expression context. [gbastien]
1.1.0 (2025-05-05)
- Added Plone 6.1 version in buildout. [sgeulette]
1.0.0 (2024-09-18)
- Generated universal wheel version. [sgeulette]
1.0a2 (2024-09-16)
- Fix dict iteration for Python 3 [laulaz]
- Updated Makefile [sgeulette]
- Used pyenv in gha [sgeulette]
1.0a1 (2023-06-21)
- Fix deprecated import AccessControl.class_init instead of App.class_init (Plone6 compatibility) [boulch]
- Set simpler setup with Makefile [sgeulette]
0.14 (2021-06-29)
- Fix pypi broken package [boulch]
0.13 (2021-06-29)
- Add uninstall profile [boulch]
- Add Plone6 compatibility [boulch]
0.12 (2021-04-20)
- Add Transifex.net service integration to manage the translation process. [macagua]
- Add Spanish translation [macagua]
- Do not consider the
archetypes.schemaextenderon Plone5. [gbastien] - Adapted code (except, implementer) to be Python3 compatible. [gbastien]
- Added parameter
trusted=Falsetoutils._evaluateExpression, this will use a trusted expression handler instead the restricted python default. [gbastien]
0.11 (2019-05-16)
- Added parameter
raise_on_errortoutils.evaluateExpressionForto raise an error when an exception occurs instead returning False. [gbastien] - Added method
TALCondition.complete_extra_expr_ctxto the behavior to formalize the way to getextra_expr_ctxto avoid theevaluatemethod to be overridden. [gbastien]
0.10 (2018-11-20)
- Do not break if parameter
expressionpassed toutils._evaluateExpressionis None. [gbastien]
0.9 (2018-10-12)
- Added new parameter
error_pattern=WRONG_TAL_CONDITIONtoutils.evaluateExpressionForand underlyingutils._evaluateExpressionto be able to log a custom message in case an error occurs during expression evaluation. [gbastien]
0.8 (2018-06-12)
- Mark elements using behavior with
ITALConditionableinterface so it behaves like element using the AT extender. [gbastien]
0.7 (2017-03-22)
- Use CheckBoxWidget for
ITALCondition.roles_bypassing_talconditionto ease selection when displaying several elements. [gbastien]
0.6 (2016-01-12)
- Added parameter
empty_expr_is_trueto utils._evaluateExpression than may be True or False depending that we want an empty expression to be considered True or False. Previous behavior is kept in utils.evaluateExpressionFor where an empty expression is considered True. This avoid managing an empty expression in the caller method [gbastien]
0.5 (2015-12-17)
- Added method utils._evaluateExpression that receives an expression
to evaluate, it is called by utils.evaluateExpressionFor. This way, this
method may evaluate a TAL expression without getting it from the
tal_conditionattribute on the context, in case we want to evaluate arbitrary expression [gbastien]
0.4 (2015-09-16)
- Make the tal_condition field larger (from 30 to 80) for the AT extender as well as for the DX behavior [gbastien]
- Added possibility to extend TAL expression context by passing
an
extra_expr_ctxdict to utils.evaluateExpressionFor, also integrated to theevaluatemethod of the DX behavior [gbastien]
0.3 (2015-07-14)
- Corrected default value [sgeulette]
- Little optimization [sgeulette]
0.2 (2015-06-18)
- Added field
role_bypassing_talconditionto define who can bypass the condition [anuyens] - Added translations for new field [gbastien]
0.1 (2015-06-01)
- Initial release. [IMIO]
Metadata
Release files for collective.behavior.talcondition 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| collective_behavior_talcondition-2.0.0.tar.gz | 28.8 kB | Without provenance | Details for collective_behavior_talcondition-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| collective_behavior_talcondition-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for collective_behavior_talcondition-2.0.0-py3-none-any.whl |
Total release size: 57.9 kB
Release files / collective_behavior_talcondition-2.0.0.tar.gz
| Download URL | collective_behavior_talcondition-2.0.0.tar.gz |
|---|---|
| Size | 28.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
82d11ca810b4b84bd776dba4b09be8e7eeb0805c089610f5979c25ac33a7e700
|
|
BLAKE2b-256 checksum How to use checksums |
b8c671ecbb37a0e815b6a8bd2e5a1facf8f72dd51c3cea891525faf305f09d86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / collective_behavior_talcondition-2.0.0-py3-none-any.whl
| Download URL | collective_behavior_talcondition-2.0.0-py3-none-any.whl |
|---|---|
| Size | 29.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90b37951bcd257bd077a3f48f7cc7c04520d61d6d0db0ae709dc910349ba5c3e
|
|
BLAKE2b-256 checksum How to use checksums |
8bd97e5457cd8d0922c38e23de1d7628d81963436bb4241d30b777220403a28f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for collective.behavior.talcondition 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.