Created
October 21, 2013 01:38
-
-
Save metatoaster/7077489 to your computer and use it in GitHub Desktop.
psc beta to current workflow update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import transaction | |
from Acquisition import aq_base, aq_inner, aq_parent | |
from Products.CMFCore.utils import getToolByName | |
from pprint import pprint as pp | |
catalog = getToolByName(app.cmiss, 'portal_catalog') | |
releases = catalog.searchResults(portal_type='PSCRelease') | |
o = [i.getObject() for i in releases] | |
pp([(i,i.workflow_history['psc_release_workflow'][-1]['review_state']) for i in o]) | |
wftool = getToolByName(app.cmiss, 'portal_workflow') | |
wfdef = getattr(aq_base(wftool), 'psc_release_workflow', None) | |
for i in o: | |
d = {} # workflow state dict | |
d.update(i.workflow_history['psc_release_workflow'][-1]) | |
d['action'] = None | |
d['actor'] = None | |
d['comments'] = 'Manual workflow migration from published to final.' | |
# assume it was published | |
d['review_state'] = 'final' | |
wftool.setStatusOf('psc_release_workflow', i, d) | |
wfdef.updateRoleMappingsFor(i) | |
i.reindexObject() | |
transaction.commit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment