Commit 631f9063 authored by Arnaud Fontaine's avatar Arnaud Fontaine

py3: DCWorkflow is python2-only so make ERP5Site creation work on Python3...

py3: DCWorkflow is python2-only so make ERP5Site creation work on Python3 WITH_LEGACY_WORKFLOW=False.

ERP5 Workflow implementation should ideally not depend on DCWorkflow at all so
that legacy DCWorkflow can be disabled for Python2 but this would require much
more work.
parent 31c0d8c1
...@@ -37,13 +37,15 @@ class PortalTypeClassInteractor(Interactor): ...@@ -37,13 +37,15 @@ class PortalTypeClassInteractor(Interactor):
and dynamic properties. and dynamic properties.
""" """
def install(self): def install(self):
from Products.DCWorkflow.Transitions import Transitions from Products.ERP5Type import WITH_LEGACY_WORKFLOW
self.on(Transitions.addTransition).doAfter(self.resetDynamic) if WITH_LEGACY_WORKFLOW:
self.on(Transitions.deleteTransitions).doAfter(self.resetDynamic) from Products.DCWorkflow.Transitions import Transitions
from Products.DCWorkflow.Transitions import TransitionDefinition self.on(Transitions.addTransition).doAfter(self.resetDynamic)
self.on(TransitionDefinition.setProperties).doAfter(self.resetDynamic) self.on(Transitions.deleteTransitions).doAfter(self.resetDynamic)
from Products.DCWorkflow.Variables import Variables from Products.DCWorkflow.Transitions import TransitionDefinition
self.on(Variables.setStateVar).doAfter(self.resetDynamic) self.on(TransitionDefinition.setProperties).doAfter(self.resetDynamic)
from Products.DCWorkflow.Variables import Variables
self.on(Variables.setStateVar).doAfter(self.resetDynamic)
from Products.Localizer.Localizer import Localizer from Products.Localizer.Localizer import Localizer
self.on(Localizer.add_language).doAfter(self.resetDynamic) self.on(Localizer.add_language).doAfter(self.resetDynamic)
......
...@@ -81,7 +81,9 @@ def initialize( context ): ...@@ -81,7 +81,9 @@ def initialize( context ):
'WorkflowException') 'WorkflowException')
# Make sure InteactionWorkflow is visible in UI # Make sure InteactionWorkflow is visible in UI
import Products.ERP5.InteractionWorkflow from Products.ERP5Type import WITH_LEGACY_WORKFLOW
if WITH_LEGACY_WORKFLOW:
import Products.ERP5.InteractionWorkflow
# backward compatibility names # backward compatibility names
XML = None XML = None
......
...@@ -91,8 +91,6 @@ from Products.DCWorkflow.utils import Message as _ ...@@ -91,8 +91,6 @@ from Products.DCWorkflow.utils import Message as _
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.Globals import PersistentMapping, InitializeClass from Products.ERP5Type.Globals import PersistentMapping, InitializeClass
from Products.ERP5Type.patches.WorkflowTool import (SECURITY_PARAMETER_ID,
WORKLIST_METADATA_KEY)
from Products.ERP5Type.Utils import convertToMixedCase from Products.ERP5Type.Utils import convertToMixedCase
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.Core.WorkflowTransition import (TRIGGER_AUTOMATIC, from Products.ERP5Type.Core.WorkflowTransition import (TRIGGER_AUTOMATIC,
...@@ -509,6 +507,8 @@ class Workflow(XMLObject): ...@@ -509,6 +507,8 @@ class Workflow(XMLObject):
security_manager = getSecurityManager() security_manager = getSecurityManager()
workflow_id = self.getId() workflow_id = self.getId()
workflow_title = self.getTitle() workflow_title = self.getTitle()
from Products.ERP5Type.Tool.WorkflowTool import (SECURITY_PARAMETER_ID,
WORKLIST_METADATA_KEY)
for worklist_definition in worklist_value_list: for worklist_definition in worklist_value_list:
action_box_name = worklist_definition.getActionName() action_box_name = worklist_definition.getActionName()
guard_role_list = worklist_definition.getGuardRoleList() guard_role_list = worklist_definition.getGuardRoleList()
......
...@@ -75,6 +75,20 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -75,6 +75,20 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
'DublinCore', 'DublinCore',
) )
def _isBootstrapRequired(self):
"""
Required by synchronizeDynamicModules() to bootstrap an empty site and
thus create portal_components
"""
return False
def _bootstrap(self):
"""
Required by synchronizeDynamicModules() to bootstrap an empty site and
thus create portal_components
"""
pass
def filtered_meta_types(self, user=None): def filtered_meta_types(self, user=None):
return False return False
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
############################################################################## ##############################################################################
import six
from Products.ERP5Type import WITH_LEGACY_WORKFLOW from Products.ERP5Type import WITH_LEGACY_WORKFLOW
...@@ -63,7 +64,8 @@ from Products.ERP5Type.patches import PythonScript ...@@ -63,7 +64,8 @@ from Products.ERP5Type.patches import PythonScript
from Products.ERP5Type.patches import MailHost from Products.ERP5Type.patches import MailHost
from Products.ERP5Type.patches import http_server from Products.ERP5Type.patches import http_server
from Products.ERP5Type.patches import memcache_client from Products.ERP5Type.patches import memcache_client
from Products.ERP5Type.patches import StateChangeInfoPatch if WITH_LEGACY_WORKFLOW:
from Products.ERP5Type.patches import StateChangeInfoPatch
from Products.ERP5Type.patches import transforms from Products.ERP5Type.patches import transforms
from Products.ERP5Type.patches import OFSPdata from Products.ERP5Type.patches import OFSPdata
from Products.ERP5Type.patches import make_hidden_input from Products.ERP5Type.patches import make_hidden_input
...@@ -79,7 +81,9 @@ from Products.ERP5Type.patches import zopecontenttype ...@@ -79,7 +81,9 @@ from Products.ERP5Type.patches import zopecontenttype
from Products.ERP5Type.patches import OFSImage from Products.ERP5Type.patches import OFSImage
from Products.ERP5Type.patches import _transaction from Products.ERP5Type.patches import _transaction
from Products.ERP5Type.patches import default_zpublisher_encoding from Products.ERP5Type.patches import default_zpublisher_encoding
from Products.ERP5Type.patches import DCWorkflowGraph if six.PY2:
# DCWorkflowGraph is dead since 2011, so no py3 version
from Products.ERP5Type.patches import DCWorkflowGraph
from Products.ERP5Type.patches import SourceCodeEditorZMI from Products.ERP5Type.patches import SourceCodeEditorZMI
from Products.ERP5Type.patches import CachingPolicyManager from Products.ERP5Type.patches import CachingPolicyManager
from Products.ERP5Type.patches import AcceleratedHTTPCacheManager from Products.ERP5Type.patches import AcceleratedHTTPCacheManager
...@@ -97,5 +101,6 @@ from Products.ERP5Type.patches import urllib_opener ...@@ -97,5 +101,6 @@ from Products.ERP5Type.patches import urllib_opener
# These symbols are required for backward compatibility # These symbols are required for backward compatibility
from Products.ERP5Type.patches.PropertyManager import ERP5PropertyManager from Products.ERP5Type.patches.PropertyManager import ERP5PropertyManager
from Products.ERP5Type.Core.Workflow import ValidationFailed from Products.ERP5Type.Core.Workflow import ValidationFailed
from Products.ERP5Type.patches.DCWorkflow import ERP5TransitionDefinition if WITH_LEGACY_WORKFLOW:
from Products.ERP5Type.patches.DCWorkflow import ERP5TransitionDefinition
from Products.ERP5Type.patches.BTreeFolder2 import ERP5BTreeFolder2Base from Products.ERP5Type.patches.BTreeFolder2 import ERP5BTreeFolder2Base
...@@ -36,7 +36,11 @@ from .patches import python, pylint, globalrequest ...@@ -36,7 +36,11 @@ from .patches import python, pylint, globalrequest
from zLOG import LOG, INFO from zLOG import LOG, INFO
DISPLAY_BOOT_PROCESS = False DISPLAY_BOOT_PROCESS = False
WITH_LEGACY_WORKFLOW = True # BBB if six.PY3:
# DCWorkflow python2-only
WITH_LEGACY_WORKFLOW = False
else:
WITH_LEGACY_WORKFLOW = True
# We have a name conflict with source_reference and destination_reference, # We have a name conflict with source_reference and destination_reference,
# which are at the same time property accessors for 'source_reference' # which are at the same time property accessors for 'source_reference'
......
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
# #
############################################################################## ##############################################################################
# WITH_LEGACY_WORKFLOW from Products.ERP5Type import WITH_LEGACY_WORKFLOW
assert WITH_LEGACY_WORKFLOW
## ERP5 Workflow: This must go before any Products.DCWorkflow imports as this ## ERP5 Workflow: This must go before any Products.DCWorkflow imports as this
## patch createExprContext() from-imported in several of its modules ## patch createExprContext() from-imported in several of its modules
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
# #
############################################################################## ##############################################################################
from Products.ERP5Type import WITH_LEGACY_WORKFLOW
assert WITH_LEGACY_WORKFLOW
from Products.DCWorkflow.Expression import StateChangeInfo from Products.DCWorkflow.Expression import StateChangeInfo
from Products.PythonScripts.Utility import allow_class from Products.PythonScripts.Utility import allow_class
allow_class(StateChangeInfo) allow_class(StateChangeInfo)
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
# #
############################################################################## ##############################################################################
from Products.ERP5Type import WITH_LEGACY_WORKFLOW
assert WITH_LEGACY_WORKFLOW
# State types patch for DCWorkflow # State types patch for DCWorkflow
from Products.DCWorkflow.States import StateDefinition from Products.DCWorkflow.States import StateDefinition
from Products.ERP5Type.Globals import DTMLFile from Products.ERP5Type.Globals import DTMLFile
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
# #
############################################################################## ##############################################################################
from Products.ERP5Type import WITH_LEGACY_WORKFLOW
assert WITH_LEGACY_WORKFLOW
from zLOG import LOG, WARNING from zLOG import LOG, WARNING
from types import StringTypes from types import StringTypes
......
from Products.ERP5Type import WITH_LEGACY_WORKFLOW
assert WITH_LEGACY_WORKFLOW
from Products.DCWorkflow.Worklists import Worklists from Products.DCWorkflow.Worklists import Worklists
from Products.DCWorkflow.Worklists import WorklistDefinition from Products.DCWorkflow.Worklists import WorklistDefinition
from Products.ERP5Type.Permissions import ManagePortal from Products.ERP5Type.Permissions import ManagePortal
......
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