Unless Discussion Item has an workflow, moderation is not enabled

svn path=/plone.app.discussion/trunk/; revision=49135
This commit is contained in:
Erico Andrei
2011-04-27 17:41:07 +00:00
parent 3a224784b0
commit 1a751b495f
2 changed files with 19 additions and 13 deletions
+16 -12
View File
@@ -39,12 +39,14 @@ class View(BrowserView):
"""
context = aq_inner(self.context)
workflowTool = getToolByName(context, 'portal_workflow')
comment_workflow = workflowTool.getChainForPortalType('Discussion Item')[0]
comment_workflow = workflowTool[comment_workflow]
if 'pending' in comment_workflow.states:
return True
else:
return False
comment_workflow = workflowTool.getChainForPortalType('Discussion Item')
if comment_workflow:
comment_workflow = comment_workflow[0]
comment_workflow = workflowTool[comment_workflow]
if 'pending' in comment_workflow.states:
return True
else:
return
class ModerateCommentsEnabled(BrowserView):
@@ -56,12 +58,14 @@ class ModerateCommentsEnabled(BrowserView):
"""
context = aq_inner(self.context)
workflowTool = getToolByName(context, 'portal_workflow', None)
comment_workflow = workflowTool.getChainForPortalType('Discussion Item')[0]
comment_workflow = workflowTool[comment_workflow]
if 'pending' in comment_workflow.states:
return True
else:
return
comment_workflow = workflowTool.getChainForPortalType('Discussion Item')
if comment_workflow:
comment_workflow = comment_workflow[0]
comment_workflow = workflowTool[comment_workflow]
if 'pending' in comment_workflow.states:
return True
else:
return
class DeleteComment(BrowserView):