You are here: Home / Documentation / How To's / Script to publish all pages in a folder

Script to publish all pages in a folder

by nguyen — published Dec 01, 2013 12:10 AM, last modified Aug 16, 2016 10:50 AM

This script is the companion to Script to convert Quills blog posts to Plone pages ("Documents")

It publishes the pages ("Documents") that the conversion script created.

Create this Script (Python) in the "newblog" folder created by the above script and run it.

from Products.CMFCore.utils import getToolByName
wf_tool = getToolByName(context, 'portal_workflow')

#newblog = context['newblog']
if != 'newblog':
    return "Need to run this inside newblog folder"

items = container.contentItems()
print items
print len(items), "items"

for blogentry_tuple in [i for i in items if i[1].meta_type == 'ATDocument']:
    blogentry = blogentry_tuple[1]
    wf_tool.doActionFor(blogentry, "publish")
    print "blog entry '",, "' was published"

return printed