Back to index

plone3  3.1.7
publishItems.py
Go to the documentation of this file.
00001 ## Script (Python) "publishItems"
00002 ##parameters=items=None, comment=''
00003 ##title=
00004 ##
00005 wf_tool = context.portal_workflow
00006 
00007 if items is None:
00008 
00009     items = []
00010 
00011     for obj in context.contentValues():
00012 
00013         if ( wf_tool.getInfoFor( obj, 'review_state', '' )
00014               in ( 'private', 'pending' ) ):
00015             items.append( obj.getId() )
00016 
00017 for path in items:
00018     object = context.restrictedTraverse( path )
00019     wf_tool.doActionFor( object, 'publish', comment=comment )
00020 
00021 context.REQUEST[ 'RESPONSE' ].redirect( '%s/review?%s'
00022                    % ( context.portal_url()
00023                      , 'portal_status_message=%d+items+published.'
00024                          % len( items )
00025                      ) )