diff options
| author | Christophe Simonis <christophe@tinyerp.com> | 2008-12-09 13:37:22 +0100 |
|---|---|---|
| committer | Christophe Simonis <christophe@tinyerp.com> | 2008-12-09 13:37:22 +0100 |
| commit | c2cc3a304996fd1a7208b8e0570eef435682e75f (patch) | |
| tree | 44886a3b2b0bcddb301ab5890648d7c79a214d64 /bin/workflow/instance.py | |
| parent | b2f82b8bd636a3be14315729c8d2f08f67875553 (diff) | |
[FIX] psycopg2: in queries we must now use %s everywhere (no more %d or %f)
bzr revid: christophe@tinyerp.com-20081209123722-4kmv4pecjwiw3tm3
Diffstat (limited to 'bin/workflow/instance.py')
| -rw-r--r-- | bin/workflow/instance.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/bin/workflow/instance.py b/bin/workflow/instance.py index 9521135a0e8..ce9dfdd0c6a 100644 --- a/bin/workflow/instance.py +++ b/bin/workflow/instance.py @@ -30,8 +30,8 @@ def create(cr, ident, wkf_id): (uid,res_type,res_id) = ident cr.execute("select nextval('wkf_instance_id_seq')") id_new = cr.fetchone()[0] - cr.execute('insert into wkf_instance (id,res_type,res_id,uid,wkf_id) values (%d,%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=%d', (wkf_id,)) + 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 = [] workitem.create(cr, res, id_new, ident, stack=stack) @@ -40,10 +40,10 @@ def create(cr, ident, wkf_id): def delete(cr, ident): (uid,res_type,res_id) = ident - cr.execute('delete from wkf_instance where res_id=%d and res_type=%s', (res_id,res_type)) + cr.execute('delete from wkf_instance where res_id=%s and res_type=%s', (res_id,res_type)) def validate(cr, inst_id, ident, signal, force_running=False): - cr.execute("select * from wkf_workitem where inst_id=%d", (inst_id,)) + cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id,)) for witem in cr.dictfetchall(): stack = [] workitem.process(cr, witem, ident, signal, force_running, stack=stack) @@ -52,27 +52,27 @@ def validate(cr, inst_id, ident, signal, force_running=False): return stack and stack[0] or False def update(cr, inst_id, ident): - cr.execute("select * from wkf_workitem where inst_id=%d", (inst_id,)) + cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id,)) for witem in cr.dictfetchall(): stack = [] workitem.process(cr, witem, ident, stack=stack) return _update_end(cr, inst_id, ident) def _update_end(cr, inst_id, ident): - cr.execute('select wkf_id from wkf_instance where id=%d', (inst_id,)) + cr.execute('select wkf_id from wkf_instance where id=%s', (inst_id,)) wkf_id = cr.fetchone()[0] - cr.execute('select state,flow_stop from wkf_workitem w left join wkf_activity a on (a.id=w.act_id) where w.inst_id=%d', (inst_id,)) + cr.execute('select state,flow_stop from wkf_workitem w left join wkf_activity a on (a.id=w.act_id) where w.inst_id=%s', (inst_id,)) ok=True for r in cr.fetchall(): if (r[0]<>'complete') or not r[1]: ok=False break if ok: - cr.execute('select distinct a.name from wkf_activity a left join wkf_workitem w on (a.id=w.act_id) where w.inst_id=%d', (inst_id,)) + cr.execute('select distinct a.name from wkf_activity a left join wkf_workitem w on (a.id=w.act_id) where w.inst_id=%s', (inst_id,)) act_names = cr.fetchall() - cr.execute("update wkf_instance set state='complete' where id=%d", (inst_id,)) - cr.execute("update wkf_workitem set state='complete' where subflow_id=%d", (inst_id,)) - cr.execute("select i.id,w.osv,i.res_id from wkf_instance i left join wkf w on (i.wkf_id=w.id) where i.id in (select inst_id from wkf_workitem where subflow_id=%d)", (inst_id,)) + cr.execute("update wkf_instance set state='complete' where id=%s", (inst_id,)) + cr.execute("update wkf_workitem set state='complete' where subflow_id=%s", (inst_id,)) + cr.execute("select i.id,w.osv,i.res_id from wkf_instance i left join wkf w on (i.wkf_id=w.id) where i.id in (select inst_id from wkf_workitem where subflow_id=%s)", (inst_id,)) for i in cr.fetchall(): for act_name in act_names: validate(cr, i[0], (ident[0],i[1],i[2]), 'subflow.'+act_name[0]) |
