How to edit the value of a paper field programmatically
by
David Mudrak
—
last modified
Dec 30, 2008 05:56 PM
I wrote this how-to after I had to decrement the value of "articleform" field in all submitted papers (articles) because of the change in the vocabulary.
Create a Python script in your custom skin folder similar to the one bellow. Modify to fit your needs. Test and run. Enjoy ;-)
from Products.CMFCore.utils import getToolByName
urltool = getToolByName(context, 'portal_url')
portal = urltool.getPortalObject()
articles_container = portal.conference.Articles
articles = articles_container.folderlistingFolderContents(['Article'])
for a in articles:
print a.title_or_id()
print a.articleform
# uncomment the following line to modify the value of the field
#a.setArticleform(a.articleform - 1)
return printed

Author: