Пример #1
0
    def __call__(self):
        self.install_upgrade_profile()

        for comment in self.objects({'portal_type': 'Discussion Item'},
                                    type(self).__doc__):
            discussion = aq_parent(aq_inner(comment))
            context = aq_parent(aq_inner(discussion))
            comment_added(context,
                          comment,
                          actor_userid=comment.Creator(),
                          date=DateTime(comment.creation_date))
Пример #2
0
    def test_comment_added_activity(self):
        document = create(Builder('document').titled('The Document'))
        conversation = IConversation(document)

        comment = createObject('plone.Comment')
        comment.text = 'Comment text'
        comment_id = conversation.addComment(comment)

        with freeze(datetime(2010, 12, 25, 13, 30)):
            record_id = comment_added(document, comment)
        record = get_activity_soup().get(record_id)

        self.assertEquals({'path': '/plone/the-document',
                           'allowed_roles_and_users': ['Anonymous'],
                           'uuid': 'testcommentaddedactivity00000001',
                           'portal_type': 'Document',
                           'title': 'The Document',
                           'timestamp': 1293280200000L,
                           'action': 'comment:added',
                           'date': DateTime('2010/12/25 13:30:00'),
                           'actor': TEST_USER_ID,
                           'comment_id': comment_id,
                           'comment_text': 'Comment text',
                           'comment_text_mime_type': 'text/plain'},
                          dict(record.attrs))
Пример #3
0
def make_comment_added_activity(context, event):
    comment_added(context, event.comment)
Пример #4
0
def make_comment_added_activity(context, event):
    if not is_supported(context):
        return None

    comment_added(context, event.comment)