当前位置: 首页>>代码示例>>Python>>正文


Python IReplies.providedBy方法代码示例

本文整理汇总了Python中plone.app.discussion.interfaces.IReplies.providedBy方法的典型用法代码示例。如果您正苦于以下问题:Python IReplies.providedBy方法的具体用法?Python IReplies.providedBy怎么用?Python IReplies.providedBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plone.app.discussion.interfaces.IReplies的用法示例。


在下文中一共展示了IReplies.providedBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_add_comment

# 需要导入模块: from plone.app.discussion.interfaces import IReplies [as 别名]
# 或者: from plone.app.discussion.interfaces.IReplies import providedBy [as 别名]
    def test_add_comment(self):
        # Add comments to a CommentReplies adapter

        # Create a conversation. In this case we doesn't assign it to an
        # object, as we just want to check the Conversation object API.
        conversation = IConversation(self.portal.doc1)

        # Add a comment to the conversation
        replies = IReplies(conversation)

        comment = createObject('plone.Comment')
        comment.text = 'Comment text'
        new_id = replies.addComment(comment)
        comment = self.portal.doc1.restrictedTraverse(
            '++conversation++default/%s' % new_id)

        # Add a reply to the CommentReplies adapter of the first comment
        re_comment = createObject('plone.Comment')
        re_comment.text = 'Comment text'

        replies = IReplies(comment)

        new_re_id = replies.addComment(re_comment)

        # check that replies provides the IReplies interface
        self.assertTrue(IReplies.providedBy(replies))

        # Make sure our comment was added
        self.assertTrue(new_re_id in replies)

        # Make sure it is also reflected in the conversation
        self.assertTrue(new_re_id in conversation)

        # Make sure the conversation has the correct comment id
        self.assertEqual(conversation[new_re_id].comment_id, new_re_id)
开发者ID:a-pasquale,项目名称:plone.app.discussion,代码行数:37,代码来源:test_comment.py

示例2: test_add_comment

# 需要导入模块: from plone.app.discussion.interfaces import IReplies [as 别名]
# 或者: from plone.app.discussion.interfaces.IReplies import providedBy [as 别名]
    def test_add_comment(self):
        # Add comments to a ConversationReplies adapter

        # Create a conversation. In this case we doesn't assign it to an
        # object, as we just want to check the Conversation object API.
        conversation = IConversation(self.portal.doc1)

        replies = IReplies(conversation)

        comment = createObject('plone.Comment')
        comment.text = 'Comment text'

        new_id = replies.addComment(comment)

        # check that replies provides the IReplies interface
        self.assertTrue(IReplies.providedBy(replies))

        # Make sure our comment was added
        self.assertTrue(new_id in replies)

        # Make sure it is also reflected in the conversation
        self.assertTrue(new_id in conversation)

        self.assertEqual(conversation[new_id].comment_id, new_id)
开发者ID:giacomos,项目名称:plone.app.discussion,代码行数:26,代码来源:test_conversation.py


注:本文中的plone.app.discussion.interfaces.IReplies.providedBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。