Commit 18dbe8b4 authored by Fabien Morin's avatar Fabien Morin

some workflow don't have history variable (like...

some workflow don't have history variable (like knowledge_pad_validation_workflow) and an error is raised.
This is not good : in some cases, we can want to not have history on some workflow. In this way, None is return and nothing raised in case of workflow without history


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26131 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 837a9acb
...@@ -3158,7 +3158,10 @@ class Base( CopyContainer, ...@@ -3158,7 +3158,10 @@ class Base( CopyContainer,
wf_list = list(portal_workflow.getWorkflowsFor(self)) wf_list = list(portal_workflow.getWorkflowsFor(self))
if wf is not None: wf_list = [wf] + wf_list if wf is not None: wf_list = [wf] + wf_list
for wf in wf_list: for wf in wf_list:
history = wf.getInfoFor(self, 'history', None) try:
history = wf.getInfoFor(self, 'history', None)
except:
history = None
if history is not None: if history is not None:
if len(history): if len(history):
# Then get the first line of edit_workflow # Then get the first line of edit_workflow
...@@ -3183,7 +3186,10 @@ class Base( CopyContainer, ...@@ -3183,7 +3186,10 @@ class Base( CopyContainer,
wf_list = [wf] + wf_list wf_list = [wf] + wf_list
max_date = None max_date = None
for wf in wf_list: for wf in wf_list:
history = wf.getInfoFor(self, 'history', None) try:
history = wf.getInfoFor(self, 'history', None)
except:
history = None
if history is not None and len(history): if history is not None and len(history):
date = history[-1].get('time', None) date = history[-1].get('time', None)
# Then get the last line of edit_workflow # Then get the last line of edit_workflow
......
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