本文整理汇总了Python中collective.workspace.interfaces.IWorkspace.get方法的典型用法代码示例。如果您正苦于以下问题:Python IWorkspace.get方法的具体用法?Python IWorkspace.get怎么用?Python IWorkspace.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collective.workspace.interfaces.IWorkspace
的用法示例。
在下文中一共展示了IWorkspace.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: participation_policy_changed
# 需要导入模块: from collective.workspace.interfaces import IWorkspace [as 别名]
# 或者: from collective.workspace.interfaces.IWorkspace import get [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())
示例2: user_search_results
# 需要导入模块: from collective.workspace.interfaces import IWorkspace [as 别名]
# 或者: from collective.workspace.interfaces.IWorkspace import get [as 别名]
def user_search_results(self):
""" Add [member] to a user title if user is a member
of current workspace
"""
results = super(SharingView, self).user_search_results()
ws = IWorkspace(self.context)
roles_mapping = ws.available_groups
roles = roles_mapping.get(self.context.participant_policy.title())
for result in results:
if result["id"] in ws.members:
groups = ws.get(result["id"]).groups
for role in roles:
result["roles"][role] = "acquired"
if "Admins" in groups:
title = "administrator"
result["roles"]["TeamManager"] = "acquired"
else:
title = "member"
result["title"] = "%s [%s]" % (result["title"], title)
return results