src/pyams_content/shared/common/review.py
changeset 131 b113d88d9ee8
parent 83 cedc7584a81f
child 272 c8e9ace0bf35
equal deleted inserted replaced
130:a27c1887736f 131:b113d88d9ee8
    17 import os
    17 import os
    18 from datetime import datetime
    18 from datetime import datetime
    19 from uuid import uuid4
    19 from uuid import uuid4
    20 
    20 
    21 # import interfaces
    21 # import interfaces
       
    22 from pyams_content.interfaces import READER_ROLE
    22 from pyams_content.interfaces.review import IReviewManager, IReviewComment, IReviewComments, \
    23 from pyams_content.interfaces.review import IReviewManager, IReviewComment, IReviewComments, \
    23     REVIEW_COMMENTS_ANNOTATION_KEY, CommentAddedEvent, ICommentAddedEvent
    24     REVIEW_COMMENTS_ANNOTATION_KEY, CommentAddedEvent, ICommentAddedEvent
    24 from pyams_content.shared.common.interfaces import IWfSharedContent, IWfSharedContentRoles
    25 from pyams_content.shared.common.interfaces import IWfSharedContent, IWfSharedContentRoles
    25 from pyams_i18n.interfaces import II18n
    26 from pyams_i18n.interfaces import II18n
    26 from pyams_mail.interfaces import IPrincipalMailInfo
    27 from pyams_mail.interfaces import IPrincipalMailInfo
   220         def get_target(self):
   221         def get_target(self):
   221             context = self.context.context
   222             context = self.context.context
   222             principals = set()
   223             principals = set()
   223             protection = IProtectedObject(context, None)
   224             protection = IProtectedObject(context, None)
   224             if protection is not None:
   225             if protection is not None:
   225                 principals |= protection.get_principals('pyams.Reader')
   226                 principals |= protection.get_principals(READER_ROLE)
   226             comments = self.context.user_data.get('comments')
   227             comments = self.context.user_data.get('comments')
   227             if comments is not None:
   228             if comments is not None:
   228                 principals |= comments.reviewers
   229                 principals |= comments.reviewers
   229             source_id = self.context.source['id']
   230             source_id = self.context.source['id']
   230             if source_id in principals:
   231             if source_id in principals: