Register workflows the CMF2 way even under CFM1 so tests only need to use the...

Register workflows the CMF2 way even under CFM1 so tests only need to use the CMF2 way of creating workflows

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31628 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8fa68dca
...@@ -38,34 +38,33 @@ from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition ...@@ -38,34 +38,33 @@ from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
_workflow_factories = {} _workflow_factories = {}
try: try:
from Products.CMFCore.WorkflowTool import addWorkflowFactory from Products.CMFCore.WorkflowTool import addWorkflowFactory as baseAddWorkflowFactory
# We're on CMF 1.5 # We're on CMF 1.5
except ImportError: except ImportError:
# We're on CMF 2 # We're on CMF 2
zLOG.LOG('Products.ERP5Type.Workflow.addWorkflowFactory', def baseAddWorkflowFactory(factory, id, tittle):
zLOG.INFO, pass
summary='Registering Workflow Factories Directly',
detail='Products.CMFCore.WorkflowTool.addWorkflowFactory has ' def addWorkflowFactory(factory, id, title):
'been removed from CMFCore. Workflows will be registered as ' """addWorkflowFactory replacement
'Zope 2 style factories instead.')
def addWorkflowFactory(factory, id, title): addWorkflowFactory has been removed from CMFCore 2.x.
"""addWorkflowFactory replacement DCWorkflow, which now handles this job, consults the GenericSetup tool,
at runtime, to determine all valid workflows.
addWorkflowFactory has been removed from CMFCore 2.x.
DCWorkflow, which now handles this job, consults the GenericSetup tool, Instead of providing xml files in GenericSetup profiles for our,
at runtime, to determine all valid workflows. workflows we prepare our own Zope2 style factories for registration
in the Workflow Tool.
Instead of providing xml files in GenericSetup profiles for our, """
workflows we prepare our own Zope2 style factories for registration assert not _workflow_factories.get(id), (
in the Workflow Tool. 'Workflow with id %r already exists.' % id)
"""
assert not _workflow_factories.get(id), ( factory_info = dict(factory=factory,
'Workflow with id %r already exists.' % id) id=id,
title=title)
factory_info = dict(factory=factory, _workflow_factories[id] = factory_info
id=id, # register with CMF 1 if it's still there
title=title) baseAddWorkflowFactory(factory, id, title)
_workflow_factories[id] = factory_info
# Workflow Creation DTML # Workflow Creation DTML
manage_addWorkflowFormDtml = HTMLFile('dtml/addWorkflow', globals()) manage_addWorkflowFormDtml = HTMLFile('dtml/addWorkflow', globals())
......
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