[Zope-CMF] how to bulk publish existing documents

Joost van Lawick jvanlawick@skybernet.nl
Thu, 22 Nov 2001 10:31:53 +0100


On Thu, Nov 22, 2001 at 10:07:57AM +0100, Jens-E. Hansen wrote:
> 
> Hi!
> 
> We are in the process of establishing an intranet portal with cmf and now I'm 
> faced with the task to populate the portal with already existing html 
> documents. What ist the best way to publish hundreds of documents and 
> directories at once?
> 

I use this script:
---------------------
objList = context.ZopeFind(context, search_sub=1)

p = 0
u = 0
for obj in objList:

    try:
        context.portal_workflow.doActionFor(obj[1], 'des2pusd', \
                        comment='published automatically by manager')
        print "Published object: ", obj[1].absolute_url()
        p = p + 1
    except:
        print "Could not publish object: ", obj[1].absolute_url()
        u = u + 1

print '\nTotal number of published objects: ', p
print 'Total number of unpublished objects: ', u

return printed
---------------------

where des2pusd is the transaction to get documents from a 'Design' state to
the 'Published' state. 

Joost

-- 
Celebrate Hannibal Day this year.  Take an elephant to lunch.

--                                     --
Joost van Lawick van Pabst             Skybernet Nederland BV
E: jvanlawick@skybernet.nl             Hoofddorp
T: 023 5677687                         W: http://www.skybernet.nl/