2014-04-16 17:54:19 +02:00
|
|
|
""" Custom discussion events
|
|
|
|
"""
|
|
|
|
from zope.interface import implements
|
|
|
|
from plone.app.discussion.interfaces import IDiscussionEvent
|
|
|
|
from plone.app.discussion.interfaces import ICommentAddedEvent
|
|
|
|
from plone.app.discussion.interfaces import ICommentRemovedEvent
|
|
|
|
from plone.app.discussion.interfaces import IReplyAddedEvent
|
|
|
|
from plone.app.discussion.interfaces import IReplyRemovedEvent
|
|
|
|
|
|
|
|
class DiscussionEvent(object):
|
|
|
|
""" Custom event
|
|
|
|
"""
|
|
|
|
implements(IDiscussionEvent)
|
|
|
|
|
2014-04-17 13:57:41 +02:00
|
|
|
def __init__(self, context, comment, **kwargs):
|
2014-04-16 17:54:19 +02:00
|
|
|
self.object = context
|
2014-04-17 13:57:41 +02:00
|
|
|
self.comment = comment
|
2014-04-16 17:54:19 +02:00
|
|
|
for key, value in kwargs.items():
|
|
|
|
setattr(self, key, value)
|
|
|
|
|
|
|
|
class CommentAddedEvent(DiscussionEvent):
|
|
|
|
""" Event to be triggered when a Comment is added
|
|
|
|
"""
|
|
|
|
implements(ICommentAddedEvent)
|
|
|
|
|
|
|
|
class CommentRemovedEvent(DiscussionEvent):
|
|
|
|
""" Event to be triggered when a Comment is removed
|
|
|
|
"""
|
|
|
|
implements(ICommentRemovedEvent)
|
|
|
|
|
|
|
|
class ReplyAddedEvent(DiscussionEvent):
|
|
|
|
""" Event to be triggered when a Comment reply is added
|
|
|
|
"""
|
|
|
|
implements(IReplyAddedEvent)
|
|
|
|
|
|
|
|
class ReplyRemovedEvent(DiscussionEvent):
|
|
|
|
""" Event to be triggered when a Comment reply is removed
|
|
|
|
"""
|
|
|
|
implements(IReplyRemovedEvent)
|