Replaced use of plone.api.
That should not be done in Plone core.
This commit is contained in:
parent
719082a1d8
commit
336642ddc3
2
news/188.bugfix
Normal file
2
news/188.bugfix
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Replaced use of ``plone.api``. That should not be done in Plone core.
|
||||||
|
[maurits]
|
@ -3,7 +3,6 @@ from AccessControl import getSecurityManager
|
|||||||
from AccessControl import Unauthorized
|
from AccessControl import Unauthorized
|
||||||
from Acquisition import aq_inner
|
from Acquisition import aq_inner
|
||||||
from Acquisition import aq_parent
|
from Acquisition import aq_parent
|
||||||
from plone import api
|
|
||||||
from plone.app.discussion.events import CommentPublishedEvent
|
from plone.app.discussion.events import CommentPublishedEvent
|
||||||
from plone.app.discussion.events import CommentTransitionEvent
|
from plone.app.discussion.events import CommentTransitionEvent
|
||||||
from plone.app.discussion.events import CommentDeletedEvent
|
from plone.app.discussion.events import CommentDeletedEvent
|
||||||
@ -264,22 +263,25 @@ class CommentTransition(BrowserView):
|
|||||||
comment = aq_inner(self.context)
|
comment = aq_inner(self.context)
|
||||||
content_object = aq_parent(aq_parent(comment))
|
content_object = aq_parent(aq_parent(comment))
|
||||||
workflow_action = self.request.form.get('workflow_action', 'publish')
|
workflow_action = self.request.form.get('workflow_action', 'publish')
|
||||||
api.content.transition(comment, transition=workflow_action)
|
workflowTool = getToolByName(self.context, 'portal_workflow')
|
||||||
|
workflowTool.doActionFor(comment, workflow_action)
|
||||||
comment.reindexObject()
|
comment.reindexObject()
|
||||||
content_object.reindexObject(idxs=['total_comments'])
|
content_object.reindexObject(idxs=['total_comments'])
|
||||||
notify(CommentPublishedEvent(self.context, comment))
|
notify(CommentPublishedEvent(self.context, comment))
|
||||||
# for complexer workflows:
|
# for complexer workflows:
|
||||||
notify(CommentTransitionEvent(self.context, comment))
|
notify(CommentTransitionEvent(self.context, comment))
|
||||||
review_state_new = api.content.get_state(comment, '')
|
comment_state_translated = ''
|
||||||
|
if workflowTool.getWorkflowsFor(comment):
|
||||||
comment_state_translated = self.context.restrictedTraverse("translationhelper").translate_comment_review_state(review_state_new)
|
review_state_new = workflowTool.getInfoFor(ob=comment, name='review_state')
|
||||||
|
helper = self.context.restrictedTraverse("translationhelper")
|
||||||
|
comment_state_translated = helper.translate_comment_review_state(review_state_new)
|
||||||
|
|
||||||
msgid = _(
|
msgid = _(
|
||||||
"comment_transmitted",
|
"comment_transmitted",
|
||||||
default='Comment ${comment_state_translated}.',
|
default='Comment ${comment_state_translated}.',
|
||||||
mapping={"comment_state_translated": comment_state_translated})
|
mapping={"comment_state_translated": comment_state_translated})
|
||||||
translated = self.context.translate(msgid)
|
translated = self.context.translate(msgid)
|
||||||
api.portal.show_message(translated, self.context.REQUEST)
|
IStatusMessage(self.request).add(translated, type='info')
|
||||||
|
|
||||||
came_from = self.context.REQUEST.HTTP_REFERER
|
came_from = self.context.REQUEST.HTTP_REFERER
|
||||||
# if the referrer already has a came_from in it, don't redirect back
|
# if the referrer already has a came_from in it, don't redirect back
|
||||||
|
Loading…
Reference in New Issue
Block a user