On s'apprête à customiser le comportement aux requêtes PUT. Copie telle quelle du...
[Plinn.git] / skins / control / discussionItemDelete.py
1 ## Script (Python) "discussionItemDelete"
2 ##title=Add item to favourites
3 ##parameters=
4 from Products.CMFCore.utils import getToolByName
5 disTool = getToolByName(context, 'portal_discussion')
6 thread = context.parentsInThread()
7 content = thread[0]
8 talk = disTool.getDiscussionFor(context)
9
10 if talk.hasReplies(context) :
11 context.setStatus(True, 'Discussion thread deleted.')
12 else :
13 if len(thread) == 1:
14 context.setStatus(True, 'Comment deleted.')
15 else :
16 context.setStatus(True, 'Reply deleted.')
17
18
19 talk.deleteReply(context.id)
20
21 return context.setRedirect(content, 'object/view', **context.REQUEST.form)