source: products/qPloneComments/branches/plone3_extend/skins/qplonecomments/deleteDiscussion.py @ 858

Last change on this file since 858 was 806, checked in by crchemist, 17 years ago

Add role 'Editor' to portal.

  • Property svn:eol-style set to native
File size: 956 bytes
Line 
1## Script (Python) "deleteDiscussion"
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=Delete discussion item
9##
10
11from Products.qPloneComments.utils import manage_mails
12from Products.CMFPlone import PloneMessageFactory
13
14if obj is None:
15    obj=context
16
17parent = obj.inReplyTo()
18if parent is not None:
19    talkback = context.portal_discussion.getDiscussionFor(parent)
20else:
21    talkback = parent = obj.aq_parent
22
23# remove the discussion item
24talkback.deleteReply( obj.getId() )
25manage_mails(obj, context, 'deleting')
26
27# redirect to the object that is being discussed
28redirect_target = context.plone_utils.getDiscussionThread(talkback)[0]
29view = redirect_target.getTypeInfo().immediate_view
30
31context.plone_utils.addPortalMessage(PloneMessageFactory(u'Reply deleted.'))
32
33context.REQUEST['RESPONSE'].redirect( redirect_target.absolute_url() + '/%s' % view )
Note: See TracBrowser for help on using the repository browser.