# HG changeset patch # User Thierry Florac # Date 1510311500 -3600 # Node ID 98ed3514a780ce3c62d27d156388cb99c33551a9 # Parent c09986c167bc5bb877182dca3933a8588417e945 Moved review interface to 'features' module diff -r c09986c167bc -r 98ed3514a780 src/pyams_content/interfaces/review.py --- a/src/pyams_content/interfaces/review.py Fri Nov 10 11:57:54 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -# -# Copyright (c) 2008-2015 Thierry Florac -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -from zope.interface.interfaces import IObjectEvent, ObjectEvent - -__docformat__ = 'restructuredtext' - - -# import standard library - -# import interfaces -from zope.annotation.interfaces import IAttributeAnnotatable -from zope.container.interfaces import IContainer, IContained - -# import packages -from pyams_security.schema import Principal, PrincipalsSet -from zope.container.constraints import contains, containers -from zope.interface import implementer, Interface, Attribute -from zope.schema import Text, Choice, Datetime - -from pyams_content import _ - - -COMMENT_TYPES = {'request': _("Review request"), - 'comment': _("Reviewer comment")} - - -class ICommentAddedEvent(IObjectEvent): - """Comment added event interface""" - - comment = Attribute("New comment") - - -@implementer(ICommentAddedEvent) -class CommentAddedEvent(ObjectEvent): - """Comment added event""" - - def __init__(self, object, comment): - super(CommentAddedEvent, self).__init__(object) - self.comment = comment - - -class IReviewComment(IContained, IAttributeAnnotatable): - """Review comment interface""" - - containers('.IReviewComments') - - owner = Principal(title=_("Comment writer"), - required=True) - - comment = Text(title=_("Comment body"), - required=True) - - comment_type = Choice(title=_("Comment type"), - values=COMMENT_TYPES.keys(), - required=True, - default='comment') - - creation_date = Datetime(title=_("Creation date"), - required=False) - - -REVIEW_COMMENTS_ANNOTATION_KEY = 'pyams_content.review_comments' - - -class IReviewComments(IContainer): - """Review comments container interface""" - - contains(IReviewComment) - - reviewers = PrincipalsSet(title=_("Reviewers list"), - description=_("List of principals which reviewed the comment"), - required=False) - - def clear(self): - """Remove all comments""" - - def add_comment(self, comment): - """Add given comment to list""" - - -class IReviewManager(Interface): - """Content review interface""" - - def ask_review(self, reviewers, comment, notify=True): - """Ask for content review"""