Skip to main content

This package contains a Dexterity behavior and AT schemaextender to add a TAL condition on a content type.

Project description

https://github.com/IMIO/collective.behavior.talcondition/actions/workflows/main.yml/badge.svg?branch=master https://coveralls.io/repos/collective/collective.behavior.talcondition/badge.png PyPI badge

collective.behavior.talcondition

This package works for dexterity (behavior) and archetypes (schema extender).

It adds two fields on a content type or class:

  • 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

For AT you have to provide the ITALConditionable on your class (see testing.zcml).

For DX you just have to activate the behavior on your content type.

Plone versions

It has been developed and tested for Plone 4, 5, 6.

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.

Changelog

1.1.3 (2026-06-19)

  • In case an error occurs, output more informations to the log. [gbastien]

1.1.2 (2026-05-20)

  • Added parameter return_bool=False to utils.evaluateExpressionFor and utils._evaluateExpression to ensure that returned result will always be a bool (True or False). [gbastien]

1.1.1 (2025-08-28)

  • Added checkPermission from portal_membership to 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 simplier 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 compatibily [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.schemaextender on Plone5. [gbastien]

  • Adapted code (except, implementer) to be Python3 compatible. [gbastien]

  • Added parameter trusted=False to utils._evaluateExpression, this will use a trusted expression handler instead the restricted python default. [gbastien]

0.11 (2019-05-16)

  • Added parameter raise_on_error to utils.evaluateExpressionFor to raise an error when an exception occurs instead returning False. [gbastien]

  • Added method TALCondition.complete_extra_expr_ctx to the behavior to formalize the way to get extra_expr_ctx to avoid the evaluate method to be overrided. [gbastien]

0.10 (2018-11-20)

  • Do not break if parameter expression passed to utils._evaluateExpression is None. [gbastien]

0.9 (2018-10-12)

  • Added new parameter error_pattern=WRONG_TAL_CONDITION to utils.evaluateExpressionFor and underlying utils._evaluateExpression to 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 ITALConditionable interface so it behaves like element using the AT extender. [gbastien]

0.7 (2017-03-22)

  • Use CheckBoxWidget for ITALCondition.roles_bypassing_talcondition to ease selection when displaying several elements. [gbastien]

0.6 (2016-01-12)

  • Added parameter empty_expr_is_true to 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_condition attribute 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_ctx dict to utils.evaluateExpressionFor, also integrated to the evaluate method 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_talcondition to define who can bypass the condition [anuyens]

  • Added translations for new field [gbastien]

0.1 (2015-06-01)

  • Initial release. [IMIO]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collective_behavior_talcondition-1.1.3.tar.gz (24.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

collective_behavior_talcondition-1.1.3-py2.py3-none-any.whl (23.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file collective_behavior_talcondition-1.1.3.tar.gz.

File metadata

File hashes

Hashes for collective_behavior_talcondition-1.1.3.tar.gz
Algorithm Hash digest
SHA256 4dfbd8bc7714b83e92d38cd5d1df6a58734c792efccfc8616d5ffcff2cb7cc26
MD5 1e2529bc5554be481b8c4cbda546e7a8
BLAKE2b-256 521fb893f250938ee8b53ac1766af84aad5f6d00eecdb907c9fdf2a8128ed907

See more details on using hashes here.

File details

Details for the file collective_behavior_talcondition-1.1.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for collective_behavior_talcondition-1.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 228948a728df3e23a6920335c317a86cdf95acad4e74fa2841068240747e495e
MD5 41025e25473f7186e696c335b4657ee1
BLAKE2b-256 e2609e761b7966c1971278e0640388ae36a6fb2468487782c8fe946360cbaec6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page