在使用Plone 4时,我已成功创建订阅者事件以在保存自定义内容类型时执行额外处理。这我通过使用Products.Archetypes.interfaces.IObjectInitializedEvent
接口完成。异步运行Plone订阅者事件
的configure.zcml
<subscriber
for="mycustom.product.interfaces.IRepositoryItem
Products.Archetypes.interfaces.IObjectInitializedEvent"
handler=".subscribers.notifyCreatedRepositoryItem"
/>
subscribers.py
def notifyCreatedRepositoryItem(repositoryitem, event):
"""
This gets called on IObjectInitializedEvent - which occurs when a new object is created.
"""
my custom processing goes here. Should be asynchronous
但是,额外的处理有时需要太长时间了,我想知道如果有一种方法可以在后台运行,它即异步。
是否可以异步运行用户的事件,例如当一个人拯救的对象?