-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
57 additions
and
49 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
from collective.liveblog.config import PROJECTNAME | ||
|
||
import logging | ||
|
||
|
||
logger = logging.getLogger(PROJECTNAME) |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,33 @@ | ||
# -*- coding:utf-8 -*- | ||
from collective.liveblog.config import PROJECTNAME | ||
from collective.liveblog.interfaces import ILiveblog | ||
from collective.liveblog.logger import logger | ||
from ftw.upgrade.workflow import WorkflowChainUpdater | ||
from plone import api | ||
|
||
import logging | ||
|
||
|
||
logger = logging.getLogger(PROJECTNAME) | ||
|
||
|
||
def remove_workflow(context): | ||
"""Remove Liveblog Workflow and migrate objects to | ||
simple_publication_workflow.""" | ||
catalog = api.portal.get_tool('portal_catalog') | ||
mapping = { | ||
def migrate_liveblog_workflow(context): | ||
"""Migrate liveblog workflow.""" | ||
review_state_mapping = { | ||
('liveblog_workflow', 'simple_publication_workflow'): { | ||
'private': 'private', | ||
'active': 'published', | ||
'inactive': 'published'} | ||
'inactive': 'published', | ||
} | ||
} | ||
|
||
catalog = api.portal.get_tool('portal_catalog') | ||
query = dict(object_provides=ILiveblog.__identifier__) | ||
results = catalog.unrestrictedSearchResults(**query) | ||
objects = [b.getObject() for b in results] | ||
objects = (b.getObject() for b in results) | ||
|
||
# all existing liveblogs must use now simple_publication_workflow | ||
wtool = api.portal.get_tool('portal_workflow') | ||
with WorkflowChainUpdater(objects, mapping): | ||
with WorkflowChainUpdater(objects, review_state_mapping): | ||
wtool.setChainForPortalTypes( | ||
('Liveblog',), ('simple_publication_workflow',)) | ||
# don't fail on upgrade step test | ||
if getattr(wtool, 'liveblog_workflow', False): | ||
api.content.delete(obj=wtool.liveblog_workflow) | ||
logger.info('Liveblog objects now use simple_publication_workflow') | ||
|
||
logger.info('Liveblog workflow removed.') | ||
# remove liveblog_workflow | ||
if 'liveblog_workflow' in wtool: | ||
api.content.delete(obj=wtool.liveblog_workflow) | ||
logger.info('Liveblog workflow removed') |
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