本文整理汇总了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)
示例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)