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