source: products/qPloneComments/tags/2.0/skins/qplonecomments/prefs_recent_comments_delete.cpy

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

Building directory structure

File size: 878 bytes
Line 
1## Script (Python) "prefs_recent_comments_delete"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=
9##
10
11from Products.CMFCore.utils import getToolByName
12portal_discussion = getToolByName(context, "portal_discussion")
13portal_catalog = getToolByName(context, "portal_catalog")
14
15request = context.REQUEST
16comment_ids = request.get('ids')
17
18for comment_id in comment_ids:
19    comment = portal_catalog(id=comment_id,portal_type='Discussion Item')[0].getObject()
20
21    parent = comment.inReplyTo()
22    if parent is not None:
23        talkback = portal_discussion.getDiscussionFor(parent)
24    else:
25        talkback = parent = comment.aq_parent
26
27    talkback.deleteReply( comment_id )
28
29return state.set(portal_status_message='Comments was successfully deleted.')
30
Note: See TracBrowser for help on using the repository browser.