[CMF-checkins] CVS: CMF/CMFDefault/skins/zpt_generic - publishItems.py:1.1

Tres Seaver tseaver@zope.com
Sun, 30 Jun 2002 15:41:42 -0400


Update of /cvs-repository/CMF/CMFDefault/skins/zpt_generic
In directory cvs.zope.org:/tmp/cvs-serv20170/CMFDefault/skins/zpt_generic

Added Files:
	publishItems.py 
Log Message:
 - Make the 'review' method workable by including its target.

=== Added File CMF/CMFDefault/skins/zpt_generic/publishItems.py ===
## Script (Python) "publishItems"
##parameters=items=None, comment=''
##title=
##
wf_tool = context.portal_workflow

if items is None:

    items = []

    for obj in context.contentValues():

        if ( wf_tool.getInfoFor( obj, 'review_state', '' )
              in ( 'private', 'pending' ) ):
            items.append( obj.getId() )

for path in items:
    object = context.restrictedTraverse( path )
    wf_tool.doActionFor( object, 'publish', comment=comment )

context.REQUEST[ 'RESPONSE' ].redirect( '%s/review?%s'
                   % ( context.portal_url()
                     , 'portal_status_message=%d+items+published.'
                         % len( items )
                     ) )