Commit a282fc24 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: Do not export some Workflow History fields.

These are completely useless and create conflicts with VCSs.
parent fbfcb3b2
...@@ -3945,8 +3945,13 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem): ...@@ -3945,8 +3945,13 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem):
del obj.workflow_history[wf_id] del obj.workflow_history[wf_id]
continue continue
wf_history_list = obj.workflow_history[wf_id] wf_history = obj.workflow_history[wf_id][-1]
obj.workflow_history[wf_id] = WorkflowHistoryList([wf_history_list[-1]]) # Remove useless modifcation 'time' and 'actor' (conflicts with VCSs)
del wf_history['time']
del wf_history['actor']
del wf_history['comment']
obj.workflow_history[wf_id] = WorkflowHistoryList([wf_history])
def _importFile(self, file_name, file_obj): def _importFile(self, file_name, file_obj):
""" """
......
...@@ -7415,9 +7415,17 @@ class TestDocumentTemplateItem(BusinessTemplateMixin): ...@@ -7415,9 +7415,17 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
sequence['document_id'], None) sequence['document_id'], None)
self.assertNotEqual(component, None) self.assertNotEqual(component, None)
self.assertEqual(sorted(list(component.workflow_history)),
['component_validation_workflow', 'edit_workflow']) all_wf_history_dict = component.workflow_history
self.assertFalse(len(component.workflow_history['component_validation_workflow']) <= 1) self.assertEqual(sorted(list(all_wf_history_dict)),
['component_validation_workflow', 'edit_workflow'])
wf_history_dict_list = all_wf_history_dict['component_validation_workflow']
self.assertFalse(len(wf_history_dict_list) <= 1)
for wf_history_dict in wf_history_dict_list:
self.assertNotEqual(wf_history_dict.get('time'), None)
self.assertNotEqual(wf_history_dict.get('actor'), None)
self.assertNotEqual(wf_history_dict.get('comment'), None)
def stepRemoveZodbDocument(self, sequence=None, **kw): def stepRemoveZodbDocument(self, sequence=None, **kw):
self.getPortalObject().portal_components.deleteContent( self.getPortalObject().portal_components.deleteContent(
...@@ -7430,13 +7438,17 @@ class TestDocumentTemplateItem(BusinessTemplateMixin): ...@@ -7430,13 +7438,17 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
self.assertNotEqual(component, None) self.assertNotEqual(component, None)
self.assertEqual(component.getValidationState(), 'validated') self.assertEqual(component.getValidationState(), 'validated')
# Only the last Workflow History should have been exported # Only the last Workflow History should have been exported and without
# 'time' as it is not needed and create conflicts with VCSs
self.assertEqual(list(component.workflow_history), self.assertEqual(list(component.workflow_history),
['component_validation_workflow']) ['component_validation_workflow'])
validation_state_only_list = [] validation_state_only_list = []
for validation_dict in list(component.workflow_history['component_validation_workflow']): for validation_dict in component.workflow_history['component_validation_workflow']:
validation_state_only_list.append(validation_dict.get('validation_state')) validation_state_only_list.append(validation_dict.get('validation_state'))
self.assertEqual(validation_dict.get('time'), None)
self.assertEqual(validation_dict.get('actor'), None)
self.assertEqual(validation_dict.get('comment'), None)
self.assertEqual(validation_state_only_list, ['validated']) self.assertEqual(validation_state_only_list, ['validated'])
......
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