Commit 7cd6f656 authored by iv's avatar iv

Fix broken object error on conversion of Interaction Workflow

dynamic_class_generation_interaction_workflow
parent 9198bf91
...@@ -109,6 +109,9 @@ class InteractionDefinition (SimpleItem): ...@@ -109,6 +109,9 @@ class InteractionDefinition (SimpleItem):
def getTriggerMethodIdList(self): def getTriggerMethodIdList(self):
return self.method_id return self.method_id
def getTriggerOncePerTransaction(self):
return self.once_per_transaction
_properties_form = DTMLFile('interaction_properties', _dtmldir) _properties_form = DTMLFile('interaction_properties', _dtmldir)
def manage_properties(self, REQUEST, manage_tabs_message=None): def manage_properties(self, REQUEST, manage_tabs_message=None):
......
...@@ -599,7 +599,7 @@ def initializePortalTypeDynamicWorkflowMethods(ptype_klass, portal_workflow): ...@@ -599,7 +599,7 @@ def initializePortalTypeDynamicWorkflowMethods(ptype_klass, portal_workflow):
interaction_queue.append((wf_id, interaction_queue.append((wf_id,
tr_id, tr_id,
transition_id_set, transition_id_set,
tdef.once_per_transaction, tdef.getTriggerOncePerTransaction(),
method_id_matcher)) method_id_matcher))
# XXX - class stuff is missing here # XXX - class stuff is missing here
...@@ -618,7 +618,7 @@ def initializePortalTypeDynamicWorkflowMethods(ptype_klass, portal_workflow): ...@@ -618,7 +618,7 @@ def initializePortalTypeDynamicWorkflowMethods(ptype_klass, portal_workflow):
ptype_klass.security.declareProtected( ptype_klass.security.declareProtected(
Permissions.AccessContentsInformation, method_id) Permissions.AccessContentsInformation, method_id)
ptype_klass.registerWorkflowMethod(method_id, wf_id, tr_id, ptype_klass.registerWorkflowMethod(method_id, wf_id, tr_id,
tdef.once_per_transaction) tdef.getTriggerOncePerTransaction())
continue continue
# Wrap method # Wrap method
...@@ -641,7 +641,7 @@ def initializePortalTypeDynamicWorkflowMethods(ptype_klass, portal_workflow): ...@@ -641,7 +641,7 @@ def initializePortalTypeDynamicWorkflowMethods(ptype_klass, portal_workflow):
transition_id = method.getTransitionId() transition_id = method.getTransitionId()
if transition_id in transition_id_set: if transition_id in transition_id_set:
method.registerTransitionAlways(portal_type, wf_id, transition_id) method.registerTransitionAlways(portal_type, wf_id, transition_id)
if tdef.once_per_transaction: if tdef.getTriggerOncePerTransaction():
method.registerTransitionOncePerTransaction(portal_type, wf_id, tr_id) method.registerTransitionOncePerTransaction(portal_type, wf_id, tr_id)
else: else:
method.registerTransitionAlways(portal_type, wf_id, tr_id) method.registerTransitionAlways(portal_type, wf_id, tr_id)
......
...@@ -1065,7 +1065,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): ...@@ -1065,7 +1065,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
self.commit() self.commit()
self.assertEqual(1, len([m for m in self.assertEqual(1, len([m for m in
self.portal.portal_activities.getMessageList() self.portal.portal_activities.getMessageList()
if m.method_id == 'immediateReindexObject' if m.getTriggerMethodIdList() == ('immediateReindexObject',)
and m.object_path == default_organisation.getPhysicalPath()])) and m.object_path == default_organisation.getPhysicalPath()]))
self.tic() self.tic()
...@@ -1079,7 +1079,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): ...@@ -1079,7 +1079,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
self.commit() self.commit()
self.assertEqual(1, len([m for m in self.assertEqual(1, len([m for m in
self.portal.portal_activities.getMessageList() self.portal.portal_activities.getMessageList()
if m.method_id == 'immediateReindexObject' if m.getTriggerMethodIdList() == ('immediateReindexObject',)
and m.object_path == default_organisation.getPhysicalPath()])) and m.object_path == default_organisation.getPhysicalPath()]))
self.tic() self.tic()
...@@ -1095,7 +1095,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): ...@@ -1095,7 +1095,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
self.commit() self.commit()
self.assertEqual(1, len([m for m in self.assertEqual(1, len([m for m in
self.portal.portal_activities.getMessageList() self.portal.portal_activities.getMessageList()
if m.method_id == 'immediateReindexObject' if m.getTriggerMethodIdList() == ('immediateReindexObject',)
and m.object_path == default_organisation.getPhysicalPath()])) and m.object_path == default_organisation.getPhysicalPath()]))
self.tic() self.tic()
...@@ -1126,7 +1126,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): ...@@ -1126,7 +1126,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
self.commit() self.commit()
self.assertEqual(1, len([m for m in self.assertEqual(1, len([m for m in
self.portal.portal_activities.getMessageList() self.portal.portal_activities.getMessageList()
if m.method_id == 'immediateReindexObject' if m.getTriggerMethodIdList() == ('immediateReindexObject',)
and m.object_path == default_organisation.getPhysicalPath()])) and m.object_path == default_organisation.getPhysicalPath()]))
self.tic() self.tic()
...@@ -1140,7 +1140,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): ...@@ -1140,7 +1140,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
self.commit() self.commit()
self.assertEqual(1, len([m for m in self.assertEqual(1, len([m for m in
self.portal.portal_activities.getMessageList() self.portal.portal_activities.getMessageList()
if m.method_id == 'immediateReindexObject' if m.getTriggerMethodIdList() == ('immediateReindexObject',)
and m.object_path == default_organisation.getPhysicalPath()])) and m.object_path == default_organisation.getPhysicalPath()]))
self.tic() self.tic()
...@@ -1156,7 +1156,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): ...@@ -1156,7 +1156,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
self.commit() self.commit()
self.assertEqual(1, len([m for m in self.assertEqual(1, len([m for m in
self.portal.portal_activities.getMessageList() self.portal.portal_activities.getMessageList()
if m.method_id == 'immediateReindexObject' if m.getTriggerMethodIdList() == ('immediateReindexObject',)
and m.object_path == default_organisation.getPhysicalPath()])) and m.object_path == default_organisation.getPhysicalPath()]))
self.tic() self.tic()
......
...@@ -61,7 +61,7 @@ class Interaction(IdAsReferenceMixin('interaction_', "prefix"), XMLObject): ...@@ -61,7 +61,7 @@ class Interaction(IdAsReferenceMixin('interaction_', "prefix"), XMLObject):
trigger_type = TRIGGER_WORKFLOW_METHOD trigger_type = TRIGGER_WORKFLOW_METHOD
portal_type_filter = None portal_type_filter = None
portal_type_group_filter = None portal_type_group_filter = None
once_per_transaction = False trigger_once_per_transaction = False
temporary_document_disallowed = False temporary_document_disallowed = False
var_exprs = None # A mapping. var_exprs = None # A mapping.
guard = None guard = None
......
...@@ -408,7 +408,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow): ...@@ -408,7 +408,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
interaction_prop_id_to_show = sorted(['actbox_category', 'actbox_url', 'actbox_name', interaction_prop_id_to_show = sorted(['actbox_category', 'actbox_url', 'actbox_name',
'activate_script_name', 'after_script_name', 'before_commit_script_name', 'activate_script_name', 'after_script_name', 'before_commit_script_name',
'description', 'groups', 'roles', 'expr', 'permissions', 'trigger_method_id', 'description', 'groups', 'roles', 'expr', 'permissions', 'trigger_method_id',
'once_per_transaction', 'portal_type_filter', 'portal_type_group_filter', 'trigger_once_per_transaction', 'portal_type_filter', 'portal_type_group_filter',
'script_name', 'temporary_document_disallowed', 'trigger_type']) 'script_name', 'temporary_document_disallowed', 'trigger_type'])
for tdef in interaction_list: for tdef in interaction_list:
interaction_reference_list.append(tdef.getReference()) interaction_reference_list.append(tdef.getReference())
...@@ -437,13 +437,14 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow): ...@@ -437,13 +437,14 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
property_value = getattr(tdef, property_id, None) property_value = getattr(tdef, property_id, None)
sub_object = SubElement(interaction, property_id, attrib=dict(type='string')) sub_object = SubElement(interaction, property_id, attrib=dict(type='string'))
elif property_id in ['activate_script_name', 'after_script_name', elif property_id in ['activate_script_name', 'after_script_name',
'before_commit_script_name', 'portal_type_filter', 'before_commit_script_name', 'portal_type_filter', 'trigger_method_id', 'method_id',
'portal_type_group_filter', 'script_name', 'portal_type_group_filter', 'script_name', 'once_per_transaction',
'temporary_document_disallowed']: 'temporary_document_disallowed']:
if property_id == 'activate_script_name': prop_id = 'activate_script_name_list' if property_id == 'activate_script_name': prop_id = 'activate_script_name_list'
if property_id == 'after_script_name': prop_id = 'after_script_name_list' if property_id == 'after_script_name': prop_id = 'after_script_name_list'
if property_id == 'before_commit_script_name': prop_id = 'before_commit_script_name_list' if property_id == 'before_commit_script_name': prop_id = 'before_commit_script_name_list'
if property_id == 'trigger_method_id': prop_id = 'trigger_method_id_list' if property_id in ('method_id', 'trigger_method_id'): prop_id = 'trigger_method_id_list'
if property_id == 'once_per_transaction': prop_id = 'trigger_once_per_transaction'
if property_id == 'portal_type_filter': prop_id = 'portal_type_filter_list' if property_id == 'portal_type_filter': prop_id = 'portal_type_filter_list'
if property_id == 'portal_type_group_filter': prop_id = 'portal_type_group_filter_list' if property_id == 'portal_type_group_filter': prop_id = 'portal_type_group_filter_list'
if property_id == 'script_name': prop_id = 'before_script_name_list' if property_id == 'script_name': prop_id = 'before_script_name_list'
......
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