Last change
on this file since 205 was
1,
checked in by myroslav, 19 years ago
|
Building directory structure
|
File size:
1.2 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 | ## |
---|
10 | from Products.CMFPlone import transaction_note |
---|
11 | from Products.CMFCore.utils import getToolByName |
---|
12 | from Products.qPloneComments.utils import publishDiscussion, send_email |
---|
13 | |
---|
14 | if obj is None: |
---|
15 | obj=context |
---|
16 | |
---|
17 | parent = obj.inReplyTo() |
---|
18 | if parent is not None: |
---|
19 | dtool = getToolByName(context, 'portal_discussion') |
---|
20 | talkback = dtool.getDiscussionFor(parent) |
---|
21 | else: |
---|
22 | talkback = parent = obj.aq_parent |
---|
23 | |
---|
24 | reply = talkback.getReply( obj.getId() ) |
---|
25 | publishDiscussion(reply) |
---|
26 | |
---|
27 | send_notification_message = send_email(reply, container, state="published") |
---|
28 | |
---|
29 | portal_status_message='Comment+successfully+published' |
---|
30 | |
---|
31 | putils = getToolByName(context, 'plone_utils') |
---|
32 | redirect_target = putils.getDiscussionThread(talkback)[0] |
---|
33 | view = redirect_target.getTypeInfo().getActionById('view') |
---|
34 | anchor = reply.getId() |
---|
35 | |
---|
36 | transaction_note('Published discussion item') |
---|
37 | target = '%s/%s?portal_status_message=%s#%s' % (redirect_target.absolute_url(), view, portal_status_message, anchor) |
---|
38 | |
---|
39 | return context.REQUEST.RESPONSE.redirect(target) |
---|
Note: See
TracBrowser
for help on using the repository browser.