use IStatusMessage when deleting and publishing comments.

svn path=/plone.app.discussion/trunk/; revision=27566
This commit is contained in:
Timo Stollenwerk 2009-06-21 08:03:08 +00:00
parent b7b0b1801b
commit 8a5408c61d

View File

@ -151,26 +151,22 @@ class AddComment(BrowserView):
IStatusMessage(self.request).addStatusMessage(\ IStatusMessage(self.request).addStatusMessage(\
_("Username field is empty."), _("Username field is empty."),
type="info") type="info")
self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url()) return self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url())
return None
if author_email == '': if author_email == '':
IStatusMessage(self.request).addStatusMessage(\ IStatusMessage(self.request).addStatusMessage(\
_("Email field is empty."), _("Email field is empty."),
type="info") type="info")
self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url()) return self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url())
return None
if subject == '': if subject == '':
IStatusMessage(self.request).addStatusMessage(\ IStatusMessage(self.request).addStatusMessage(\
_("Subject field is empty."), _("Subject field is empty."),
type="info") type="info")
self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url()) return self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url())
return None
if text == '': if text == '':
IStatusMessage(self.request).addStatusMessage(\ IStatusMessage(self.request).addStatusMessage(\
_("Comment field is empty."), _("Comment field is empty."),
type="info") type="info")
self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url()) return self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url())
return None
# The add-comment view is called on the conversation object # The add-comment view is called on the conversation object
conversation = self.context conversation = self.context
@ -225,26 +221,22 @@ class ReplyToComment(BrowserView):
IStatusMessage(self.request).addStatusMessage(\ IStatusMessage(self.request).addStatusMessage(\
_("Username field is empty."), _("Username field is empty."),
type="info") type="info")
self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url()) return self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url())
return None
if author_email == '': if author_email == '':
IStatusMessage(self.request).addStatusMessage(\ IStatusMessage(self.request).addStatusMessage(\
_("Email field is empty."), _("Email field is empty."),
type="info") type="info")
self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url()) return self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url())
return None
if subject == '': if subject == '':
IStatusMessage(self.request).addStatusMessage(\ IStatusMessage(self.request).addStatusMessage(\
_("Subject field is empty."), _("Subject field is empty."),
type="info") type="info")
self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url()) return self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url())
return None
if text == '': if text == '':
IStatusMessage(self.request).addStatusMessage(\ IStatusMessage(self.request).addStatusMessage(\
_("Comment field is empty."), _("Comment field is empty."),
type="info") type="info")
self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url()) return self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url())
return None
# The add-comment view is called on the conversation object # The add-comment view is called on the conversation object
conversation = self.context conversation = self.context
@ -297,7 +289,10 @@ class DeleteComment(BrowserView):
del conversation[comment_id] del conversation[comment_id]
self.context.plone_utils.addPortalMessage('Comment %s deleted' % comment_id) # Todo: i18n
IStatusMessage(self.request).addStatusMessage(
_('Comment %s deleted' % comment_id),
type="info")
return self.context.REQUEST.RESPONSE.redirect(self.context.REQUEST.HTTP_REFERER) return self.context.REQUEST.RESPONSE.redirect(self.context.REQUEST.HTTP_REFERER)
class PublishComment(BrowserView): class PublishComment(BrowserView):
@ -313,5 +308,8 @@ class PublishComment(BrowserView):
portal_workflow = getToolByName(comment, 'portal_workflow') portal_workflow = getToolByName(comment, 'portal_workflow')
portal_workflow.doActionFor(comment, workflow_action) portal_workflow.doActionFor(comment, workflow_action)
self.context.plone_utils.addPortalMessage('Workflow action for commment %s changed (%s)' % (comment_id, workflow_action)) # Todo: i18n
IStatusMessage(self.request).addStatusMessage(
_('Workflow action for commment %s changed (%s)' % (comment_id, workflow_action)),
type="info")
return self.context.REQUEST.RESPONSE.redirect(self.context.REQUEST.HTTP_REFERER) return self.context.REQUEST.RESPONSE.redirect(self.context.REQUEST.HTTP_REFERER)