This package contains a Dexterity behavior and AT schemaextender to add a TAL condition on a content type.
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.
It has been developed and tested for Plone 4 and 5.
This product has been translated into
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.
Fix pypi broken package [boulch]
Add uninstall profile [boulch]
Add Plone6 compatibily [boulch]
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]
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]
Do not break if parameter expression passed to utils._evaluateExpression is None. [gbastien]
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]
Mark elements using behavior with ITALConditionable interface so it behaves like element using the AT extender. [gbastien]
Use CheckBoxWidget for ITALCondition.roles_bypassing_talcondition to ease selection when displaying several elements. [gbastien]
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]
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]
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]
Corrected default value [sgeulette]
Little optimization [sgeulette]
Added field role_bypassing_talcondition to define who can bypass the condition [anuyens]
Added translations for new field [gbastien]
Initial release. [IMIO]
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for collective.behavior.talcondition-0.14.tar.gz
Hashes for collective.behavior.talcondition-0.14-py2-none-any.whl