|
Last change
on this file was
800,
checked in by crchemist, 19 years ago
|
|
Deleted mistakable folder.
|
-
Property svn:eol-style set to
native
|
|
File size:
935 bytes
|
| Line | |
|---|
| 1 | ## Script (Python) "prefs_recent_comments_publish" |
|---|
| 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 | from Products.CMFCore.utils import getToolByName |
|---|
| 11 | from Products.qPloneComments.utils import publishDiscussion, manage_mails |
|---|
| 12 | from Products.qPloneComments.utils import setStatusMsg |
|---|
| 13 | from Products.CMFPlone import MessageFactory |
|---|
| 14 | _ = MessageFactory('plonecomments') |
|---|
| 15 | |
|---|
| 16 | request = context.REQUEST |
|---|
| 17 | |
|---|
| 18 | comment_ids = request.get('ids', []) |
|---|
| 19 | portal_catalog = getToolByName(context, "portal_catalog") |
|---|
| 20 | |
|---|
| 21 | for comment_id in comment_ids: |
|---|
| 22 | comment = portal_catalog(id=comment_id,portal_type='Discussion Item')[0].getObject() |
|---|
| 23 | publishDiscussion(comment) |
|---|
| 24 | manage_mails(comment, container, action='publishing') |
|---|
| 25 | |
|---|
| 26 | msg = comment_ids and _(u'Comment(s) published.') or _(u'Please select items to be processed.') |
|---|
| 27 | setStatusMsg(state, context, msg) |
|---|
| 28 | |
|---|
| 29 | return state |
|---|
Note: See
TracBrowser
for help on using the repository browser.