From 9be49ee767f9757b0a730be9d87036a7890e0645 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Sun, 14 Jun 2009 07:19:37 +0000 Subject: [PATCH] fix delete and publish comment methods. svn path=/plone.app.discussion/trunk/; revision=27415 --- plone/app/discussion/browser/comments.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index 377d4df..c339ec8 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -208,16 +208,15 @@ class DeleteComment(BrowserView): def __call__(self): comment = aq_inner(self.context) - - # Sanity check - comment_id = self.request.form['comment_id'] - if comment_id != comment.getId(): - raise ValueError + comment_id = self.context.id conversation = self.context.__parent__ del conversation[comment_id] + self.context.plone_utils.addPortalMessage('Conversation %s deleted' % comment_id) + return self.context.REQUEST.RESPONSE.redirect(self.context.REQUEST.HTTP_REFERER) + class PublishComment(BrowserView): """Publish a comment """ @@ -225,12 +224,11 @@ class PublishComment(BrowserView): def __call__(self): comment = aq_inner(self.context) + comment_id = self.context.id - # Sanity check - comment_id = self.request.form['comment_id'] - if comment_id != comment.getId(): - raise ValueError - - action = self.request.form['action'] + workflow_action = self.request.form['workflow_action'] portal_workflow = getToolByName(comment, 'portal_workflow') - portal_workflow.doActionFor(comment, action) \ No newline at end of file + portal_workflow.doActionFor(comment, workflow_action) + + self.context.plone_utils.addPortalMessage('Conversation %s workflow action %s' % (comment_id, workflow_action)) + return self.context.REQUEST.RESPONSE.redirect(self.context.REQUEST.HTTP_REFERER)