Concentrate all imports of addWorkflowFactory to a location under our control....

Concentrate all imports of addWorkflowFactory to a location under our control. For CMF 2.x we will emulate this function by creating actual Zope2 Factories for our workflows.

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/portal_types@29477 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 982fd5c6
...@@ -26,7 +26,7 @@ from Products.CMFCore.utils import getToolByName ...@@ -26,7 +26,7 @@ from Products.CMFCore.utils import getToolByName
from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
from Products.DCWorkflow.Transitions import TRIGGER_WORKFLOW_METHOD from Products.DCWorkflow.Transitions import TRIGGER_WORKFLOW_METHOD
from Products.DCWorkflow.Expression import StateChangeInfo, createExprContext from Products.DCWorkflow.Expression import StateChangeInfo, createExprContext
from Products.CMFCore.WorkflowTool import addWorkflowFactory from Products.ERP5Type.patches.DCWorkflow import addWorkflowFactory
from Products.CMFActivity.ActiveObject import ActiveObject from Products.CMFActivity.ActiveObject import ActiveObject
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
......
...@@ -609,13 +609,26 @@ TransitionDefinition.getAvailableScriptIds = getAvailableScriptIds ...@@ -609,13 +609,26 @@ TransitionDefinition.getAvailableScriptIds = getAvailableScriptIds
try: try:
from Products.CMFCore.WorkflowTool import addWorkflowFactory from Products.CMFCore.WorkflowTool import addWorkflowFactory
except ImportError: except ImportError:
import zLOG def addWorkflowFactory(factory, id, title):
zLOG.LOG('Products.ERP5Type.patches.DCWorkflow', """addWorkflowFactory replacement
zLOG.ERROR,
'Products.CMFCore.WorkflowTool.addWorkflowFactory has been removed. ' addWorkflowFactory has been removed from CMF 2.x.
'ERP5 Workflow factory not installed', DCWorkflow, which actually handled the workflows added by this function
error=sys.exc_info()) now consults the GenericSetup tool, at runtime to determine all valid
addWorkflowFactory = lambda factory, id, title: None workflows.
Instead of providing GenericSetup profiles for our workflows, we
install our own Zope2 style factories for the Workflow Tool
"""
import zLOG
zLOG.LOG('Products.ERP5Type.patches.DCWorkflow.addWorkflowFactory',
zLOG.ERROR,
summary='Workflow Factory not registered',
detail='Products.CMFCore.WorkflowTool.addWorkflowFactory has '
'been removed from CMFCore, and a replacement has not been '
'written yet. ERP5 Workflow factory for '
'%s (%s) not installed.' % (id, title))
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
def setupERP5Workflow(wf): def setupERP5Workflow(wf):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment