From c25b122b3c2803d75ac95a947f3419cc8fc87968 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Fri, 1 May 2009 23:48:18 +0300 Subject: Workflow: optimize out one SQL command. bzr revid: p_christ@hol.gr-20090501204818-fzmdw4w09bcukr4n --- bin/workflow/instance.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'bin/workflow/instance.py') diff --git a/bin/workflow/instance.py b/bin/workflow/instance.py index b78b5ae7dbe..99e041ab860 100644 --- a/bin/workflow/instance.py +++ b/bin/workflow/instance.py @@ -28,9 +28,8 @@ import pooler def create(cr, ident, wkf_id): (uid,res_type,res_id) = ident - cr.execute("select nextval('wkf_instance_id_seq')") + cr.execute('insert into wkf_instance (res_type,res_id,uid,wkf_id) values (%s,%s,%s,%s) RETURNING id', (res_type,res_id,uid,wkf_id)) id_new = cr.fetchone()[0] - cr.execute('insert into wkf_instance (id,res_type,res_id,uid,wkf_id) values (%s,%s,%s,%s,%s)', (id_new,res_type,res_id,uid,wkf_id)) cr.execute('select * from wkf_activity where flow_start=True and wkf_id=%s', (wkf_id,)) res = cr.dictfetchall() stack = [] -- cgit v1.2.3 From b7fe61abe9d0369de3c4a064bd89d0266a0d1d41 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 5 May 2009 00:18:03 +0300 Subject: Workflows: tolerate non-ending, missing instances. bzr revid: p_christ@hol.gr-20090504211803-pcqu4w9x50v693p8 --- bin/workflow/instance.py | 1 + 1 file changed, 1 insertion(+) (limited to 'bin/workflow/instance.py') diff --git a/bin/workflow/instance.py b/bin/workflow/instance.py index 99e041ab860..8f1c8455598 100644 --- a/bin/workflow/instance.py +++ b/bin/workflow/instance.py @@ -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) -- cgit v1.2.3