source: products/qPloneComments/branches/plone-2.5/skins/qplonecomments/2.0.5/discussion_publish_comment.py

Last change on this file was 1, checked in by myroslav, 19 years ago

Building directory structure

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1## Script (Python) "discussion_publish_comment"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=obj=None
8##title=
9##
10from Products.CMFPlone import transaction_note
11from Products.CMFCore.utils import getToolByName
12from Products.qPloneComments.utils import publishDiscussion
13from Products.qPloneComments.utils import manage_mails
14
15if obj is None:
16    obj=context
17
18parent = obj.inReplyTo()
19if parent is not None:
20    dtool = getToolByName(context, 'portal_discussion')
21    talkback = dtool.getDiscussionFor(parent)
22else:
23    talkback = parent = obj.aq_parent
24
25reply = talkback.getReply( obj.getId() )
26publishDiscussion(reply)
27manage_mails(reply, context, action='publishing')
28
29portal_status_message='Comment+published'
30
31transaction_note('Published discussion item')
32target = '%s/%s?portal_status_message=%s' % (context.absolute_url(), context.getTypeInfo().getActionById('view'), 
33                                             portal_status_message)
34
35return context.REQUEST.RESPONSE.redirect(target)
Note: See TracBrowser for help on using the repository browser.