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
from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
from Products.DCWorkflow.Transitions import TRIGGER_WORKFLOW_METHOD
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.ERP5Type import Permissions
......
......@@ -609,13 +609,26 @@ TransitionDefinition.getAvailableScriptIds = getAvailableScriptIds
try:
from Products.CMFCore.WorkflowTool import addWorkflowFactory
except ImportError:
import zLOG
zLOG.LOG('Products.ERP5Type.patches.DCWorkflow',
zLOG.ERROR,
'Products.CMFCore.WorkflowTool.addWorkflowFactory has been removed. '
'ERP5 Workflow factory not installed',
error=sys.exc_info())
addWorkflowFactory = lambda factory, id, title: None
def addWorkflowFactory(factory, id, title):
"""addWorkflowFactory replacement
addWorkflowFactory has been removed from CMF 2.x.
DCWorkflow, which actually handled the workflows added by this function
now consults the GenericSetup tool, at runtime to determine all valid
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
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