当前位置: 首页>>代码示例>>Python>>正文


Python IRuleAssignmentManager.getRules方法代码示例

本文整理汇总了Python中plone.contentrules.engine.interfaces.IRuleAssignmentManager.getRules方法的典型用法代码示例。如果您正苦于以下问题:Python IRuleAssignmentManager.getRules方法的具体用法?Python IRuleAssignmentManager.getRules怎么用?Python IRuleAssignmentManager.getRules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plone.contentrules.engine.interfaces.IRuleAssignmentManager的用法示例。


在下文中一共展示了IRuleAssignmentManager.getRules方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __call__

# 需要导入模块: from plone.contentrules.engine.interfaces import IRuleAssignmentManager [as 别名]
# 或者: from plone.contentrules.engine.interfaces.IRuleAssignmentManager import getRules [as 别名]
    def __call__(self, event, bubbled=False, rule_filter=None):
        assignments = IRuleAssignmentManager(self.context)
        for rule in assignments.getRules(event, bubbled=bubbled):
            # for each rule assigned in this context - bubbled means rule apply on subfolders
            if rule_filter is None or rule_filter(self.context, rule, event) == True:
                # execute the rule if it is not filtered, for exemple,
                # it has not been executed on the same content but from an other context
                # in the same request

                # we store cascading option in the filter. if true, this will allow
                # rules to be executed because of the actions ran by this rule.
                if rule_filter is not None:
                    cascade_before = getattr(rule_filter, 'cascade', False)
                    rule_filter.cascade = rule.cascading

                executable = getMultiAdapter((self.context, rule, event), IExecutable)
                executable()

                if rule_filter is not None:
                    rule_filter.cascade = cascade_before

                if rule.stop:
                    # stop rule execution if 'Stop rules after' option has been selected
                    raise StopRule(rule)
开发者ID:plone,项目名称:plone.contentrules,代码行数:26,代码来源:executor.py


注:本文中的plone.contentrules.engine.interfaces.IRuleAssignmentManager.getRules方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。