Merge pull request #28 from witsch/non-annotatables
fix for non-annotatable objects
This commit is contained in:
commit
ad8d55cdb9
7
buildout.cfg
Normal file
7
buildout.cfg
Normal file
@ -0,0 +1,7 @@
|
||||
[buildout]
|
||||
extends = https://raw.github.com/collective/buildout.plonetest/master/test-4.3.x.cfg
|
||||
package-name = plone.app.discussion
|
||||
package-extras = [test]
|
||||
|
||||
[versions]
|
||||
plone.app.discussion =
|
@ -358,7 +358,10 @@ class CommentsViewlet(ViewletBase):
|
||||
returned with workflow actions.
|
||||
"""
|
||||
context = aq_inner(self.context)
|
||||
conversation = IConversation(context)
|
||||
conversation = IConversation(context, None)
|
||||
|
||||
if conversation is None:
|
||||
return iter([])
|
||||
|
||||
wf = getToolByName(context, 'portal_workflow')
|
||||
|
||||
|
@ -370,6 +370,14 @@ class TestCommentsViewlet(unittest.TestCase):
|
||||
replies.next()
|
||||
self.assertRaises(StopIteration, replies.next)
|
||||
|
||||
def test_get_replies_on_non_annotatable_object(self):
|
||||
context = self.portal.MailHost # the mail host is not annotatable
|
||||
viewlet = CommentsViewlet(context, self.request, None, None)
|
||||
replies = viewlet.get_replies()
|
||||
self.assertEqual(len(tuple(replies)), 0)
|
||||
replies = viewlet.get_replies()
|
||||
self.assertRaises(StopIteration, replies.next)
|
||||
|
||||
def test_get_replies_with_workflow_actions(self):
|
||||
self.assertFalse(self.viewlet.get_replies(workflow_actions=True))
|
||||
comment = createObject('plone.Comment')
|
||||
|
Loading…
Reference in New Issue
Block a user