如何在设置本地角色后触发事件

时间:2013-03-27 14:17:52

标签: python plone zope

我想用“manage_setLocalRoles”方法附加事件的触发器。 像这样:

def send_participation_request(self): 
    review_state = self.portal_workflow.getInfoFor(self.context, "review_state", "") 
    if review_state =="public":
        self.context.manage_setLocalRoles(user.id,["Role"]) #fire event
        self.context.reindexObjectSecurity()
    return False

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

.manage_setLocalRoles()不会发出任何事件。该代码早于Zope 3事件。

你必须改为创建一个猴子补丁钩子,否则只要你自己的代码调用那个方法就自己发出一个事件。

相关问题