From 7e4889279ceb6b11dad0a4c33188cba1c90330aa Mon Sep 17 00:00:00 2001 From: Wenjie Zheng <wenjie.zheng@tiolive.com> Date: Wed, 27 May 2015 12:46:09 +0000 Subject: [PATCH] WorkflowTool.py: patch the ImmutableId to allow migrating CMF Workflow Tool to ERP5 Workflow Tool. --- product/ERP5Type/patches/WorkflowTool.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/product/ERP5Type/patches/WorkflowTool.py b/product/ERP5Type/patches/WorkflowTool.py index c2204e2d51..44cd5e6f87 100644 --- a/product/ERP5Type/patches/WorkflowTool.py +++ b/product/ERP5Type/patches/WorkflowTool.py @@ -28,7 +28,7 @@ from Products.DCWorkflow.Transitions import TRIGGER_WORKFLOW_METHOD, TransitionD from Products.CMFCore.utils import getToolByName from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, AutoQuery, ComplexQuery, NegatedQuery -from Products.CMFCore.utils import _getAuthenticatedUser +from Products.CMFCore.utils import _getAuthenticatedUser, ImmutableId from Products.ERP5Type.Cache import CachingMethod from sets import ImmutableSet from Acquisition import aq_base @@ -65,6 +65,18 @@ class ExclusionTuple(tuple): """ pass +def ImmutableId_setId(self): + """ patch which allows modifying the Id of portal_workflow + for the sake of workflow tool migration. + """ + if self.getId() in ['portal_workflow', 'portal_workflow_new']: + pass + else: + if id != self.getId(): + raise ValueError('Changing the id of this object is forbidden: %s' + % self.getId()) +ImmutableId._setId = ImmutableId_setId + def getValidCriterionDict(worklist_match_dict, sql_catalog, workflow_worklist_key): valid_criterion_dict = {} -- 2.30.9