Commit db225b98 authored by Julien Muchembled's avatar Julien Muchembled

Implement code to raise when workflow method call is not supported. Disabled for the moment.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27796 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f3f6031a
......@@ -68,7 +68,7 @@ from ZopePatch import ERP5PropertyManager
from CopySupport import CopyContainer, CopyError,\
tryMethodCallWithTemporaryPermission
from Errors import DeferredCatalogError
from Errors import DeferredCatalogError, UnsupportedWorkflowMethod
from Products.CMFActivity.ActiveObject import ActiveObject
from Products.ERP5Type.Accessor.Accessor import Accessor as Method
from Products.ERP5Type.Accessor.TypeDefinition import asDate
......@@ -207,7 +207,9 @@ class WorkflowMethod(Method):
for transition_id in transition_list:
if candidate_workflow.isWorkflowMethodSupported(instance, transition_id):
valid_list.append(transition_id)
else:
elif candidate_workflow.__class__.__name__ == 'DCWorkflowDefinition':
if 0: # disabled for the moment
raise UnsupportedWorkflowMethod(instance, wf_id, transition_id)
LOG("WorkflowMethod.__call__", ERROR,
"Transition %s/%s on %r is ignored. Current state is %r."
% (wf_id, transition_id, instance,
......
......@@ -7,6 +7,7 @@
from Products.PythonScripts.Utility import allow_class
from Products.CMFCore.WorkflowCore import WorkflowException
class DeferredCatalogError(Exception):
def __init__(self, error_key, context):
......@@ -14,6 +15,7 @@ class DeferredCatalogError(Exception):
self.error_key = error_key
self.field_id = context.getRelativeUrl()
class SSHConnectionError(Exception):
def __init__(self, message):
Exception.__init__(self, message)
......@@ -22,13 +24,30 @@ class SSHConnectionError(Exception):
def __str__(self):
return self.message
class UnsupportedWorkflowMethod(WorkflowException):
def __init__(self, instance, workflow_id, transition_id):
self.instance = instance
self.workflow_id = workflow_id
self.transition_id = transition_id
def __str__(self):
return "Transition %s/%s unsupported for %r. Current state is %r." \
% (self.workflow_id, self.transition_id, self.instance,
self.instance.getPortalObject().portal_workflow[self.workflow_id]
._getWorkflowStateOf(self.instance, id_only=1))
class ImmobilisationValidityError(Exception):pass
class ImmobilisationCalculationError(Exception):pass
class TransformationRuleError(Exception):pass
allow_class(DeferredCatalogError)
allow_class(SSHConnectionError)
allow_class(ImmobilisationValidityError)
allow_class(ImmobilisationCalculationError)
allow_class(WorkflowException)
allow_class(UnsupportedWorkflowMethod)
allow_class(TransformationRuleError)
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