本文整理汇总了Python中collective.workspace.interfaces.IWorkspace.group_for_policy方法的典型用法代码示例。如果您正苦于以下问题:Python IWorkspace.group_for_policy方法的具体用法?Python IWorkspace.group_for_policy怎么用?Python IWorkspace.group_for_policy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collective.workspace.interfaces.IWorkspace
的用法示例。
在下文中一共展示了IWorkspace.group_for_policy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: participation_policy_changed
# 需要导入模块: from collective.workspace.interfaces import IWorkspace [as 别名]
# 或者: from collective.workspace.interfaces.IWorkspace import group_for_policy [as 别名]
def participation_policy_changed(ob, event):
""" Move all the existing users to a new group """
workspace = IWorkspace(ob)
old_group_name = workspace.group_for_policy(event.old_policy)
old_group = api.group.get(old_group_name)
for member in old_group.getAllGroupMembers():
groups = workspace.get(member.getId()).groups
groups -= set([event.old_policy.title()])
groups.add(event.new_policy.title())