Workflows: tolerate non-ending, missing instances.

bzr revid: p_christ@hol.gr-20090504211803-pcqu4w9x50v693p8
This commit is contained in:
P. Christeas 2009-05-05 00:18:03 +03:00
parent c25b122b3c
commit b7fe61abe9
2 changed files with 5 additions and 1 deletions

View File

@ -82,7 +82,10 @@ def graph_get(cr, graph, wkf_id, nested=False, workitem={}):
start = cr.fetchone()[0]
cr.execute("select 'subflow.'||name,id from wkf_activity where flow_stop=True and wkf_id=%s", (wkf_id,))
stop = cr.fetchall()
stop = (stop[0][1], dict(stop))
if (stop):
stop = (stop[0][1], dict(stop))
else:
stop = ("stop",{})
return ((start,{}),stop)

View File

@ -43,6 +43,7 @@ def delete(cr, ident):
def validate(cr, inst_id, ident, signal, force_running=False):
cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id,))
stack = None
for witem in cr.dictfetchall():
stack = []
workitem.process(cr, witem, ident, signal, force_running, stack=stack)