fix CommentViewlet has_replies method.
svn path=/plone.app.discussion/trunk/; revision=33282
This commit is contained in:
parent
b1e4b2254c
commit
1e58aa63b1
@ -218,8 +218,12 @@ class CommentsViewlet(ViewletBase, layout.FormWrapper):
|
||||
"""Returns true if there are replies.
|
||||
"""
|
||||
if self.get_replies(workflow_actions):
|
||||
try:
|
||||
self.get_replies(workflow_actions).next()
|
||||
return True
|
||||
except StopIteration:
|
||||
pass
|
||||
return False
|
||||
|
||||
def get_replies(self, workflow_actions=False):
|
||||
"""Returns all replies to a content object.
|
||||
|
@ -134,13 +134,13 @@ class TestCommentsViewlet(PloneTestCase):
|
||||
self.failUnless(self.viewlet.is_discussion_allowed())
|
||||
|
||||
def test_has_replies(self):
|
||||
self.failIf(self.viewlet.has_replies())
|
||||
self.assertEquals(self.viewlet.has_replies(), False)
|
||||
comment = createObject('plone.Comment')
|
||||
comment.title = 'Comment 1'
|
||||
comment.text = 'Comment text'
|
||||
conversation = IConversation(self.portal.doc1)
|
||||
conversation.addComment(comment)
|
||||
self.failUnless(self.viewlet.has_replies())
|
||||
self.assertEquals(self.viewlet.has_replies(), True)
|
||||
|
||||
def test_get_replies(self):
|
||||
self.failIf(self.viewlet.get_replies())
|
||||
|
Loading…
Reference in New Issue
Block a user